pub trait H5Type:
Sized
+ Send
+ Clone {
// Required methods
fn hdf5_type() -> Datatype;
fn from_bytes(bytes: &[u8], dtype: &Datatype) -> Result<Self>;
fn element_size(dtype: &Datatype) -> usize;
// Provided methods
fn decode_vec(
_raw: &[u8],
_dtype: &Datatype,
_count: usize,
) -> Option<Result<Vec<Self>>> { ... }
fn native_copy_compatible(_dtype: &Datatype) -> bool { ... }
}Expand description
Trait for types that can be read from HDF5 datasets.
Implemented for primitive numeric types. Users can implement this for custom types (e.g., compound types).
Required Methods§
Sourcefn from_bytes(bytes: &[u8], dtype: &Datatype) -> Result<Self>
fn from_bytes(bytes: &[u8], dtype: &Datatype) -> Result<Self>
Decode a single value from raw bytes with the given datatype.
Sourcefn element_size(dtype: &Datatype) -> usize
fn element_size(dtype: &Datatype) -> usize
Size of a single element in bytes.
Provided Methods§
Sourcefn decode_vec(
_raw: &[u8],
_dtype: &Datatype,
_count: usize,
) -> Option<Result<Vec<Self>>>
fn decode_vec( _raw: &[u8], _dtype: &Datatype, _count: usize, ) -> Option<Result<Vec<Self>>>
Decode many values at once when the datatype has an efficient bulk path.
Returning None falls back to per-element decoding.
Sourcefn native_copy_compatible(_dtype: &Datatype) -> bool
fn native_copy_compatible(_dtype: &Datatype) -> bool
Whether raw bytes for this datatype can be copied directly into a Vec<Self>
without any further decoding or byte swapping.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.