Skip to content

Reading array of compound datasets #276

Answered by mulimoen
ehayes2000 asked this question in Questions
Discussion options

You must be logged in to vote

The names of the compound type needs to match what is given by the datatype. You can achieve this by either using the names directly:

#[derive(hdf5::H5Type, Debug, Clone, PartialEq)]
#[repr(C)]
pub struct Coordinates {
    RowStart: i32,
    ColumnStart: i32,
    Width: i32,
    Height: i32,
}

Or by using the rename functionality of the derive macro:

#[derive(hdf5::H5Type, Debug, Clone, PartialEq)]
#[repr(C)]
pub struct Coordinates {
    #[hdf5(rename = "RowStart")]
    a: i32,
    #[hdf5(rename = "ColumnStart")]
    b: i32,
    #[hdf5(rename = "Width")]
    c: i32,
    #[hdf5(rename = "Height")]
    d: i32,
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ehayes2000
Comment options

Answer selected by ehayes2000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants