Skip to main content

Datatype

Enum Datatype 

Source
pub enum Datatype {
    FixedPoint {
        size: u32,
        byte_order: DatatypeByteOrder,
        signed: bool,
        bit_offset: u16,
        bit_precision: u16,
    },
    FloatingPoint {
        size: u32,
        byte_order: DatatypeByteOrder,
        bit_offset: u16,
        bit_precision: u16,
        exponent_location: u8,
        exponent_size: u8,
        mantissa_location: u8,
        mantissa_size: u8,
        exponent_bias: u32,
    },
    Time {
        size: u32,
        byte_order: DatatypeByteOrder,
        bit_precision: u16,
    },
    String {
        size: u32,
        padding: StringPadding,
        charset: CharacterSet,
    },
    BitField {
        size: u32,
        byte_order: DatatypeByteOrder,
        bit_offset: u16,
        bit_precision: u16,
    },
    Opaque {
        size: u32,
        tag: Vec<u8>,
    },
    Compound {
        size: u32,
        members: Vec<CompoundMember>,
    },
    Reference {
        size: u32,
        ref_type: ReferenceType,
    },
    Enumeration {
        size: u32,
        base_type: Box<Datatype>,
        members: Vec<EnumMember>,
    },
    VariableLength {
        is_string: bool,
        padding: Option<StringPadding>,
        charset: Option<CharacterSet>,
        base_type: Box<Datatype>,
    },
    Array {
        base_type: Box<Datatype>,
        dimensions: Vec<u32>,
    },
}
Expand description

Parsed HDF5 datatype.

Variants§

§

FixedPoint

Class 0: Fixed-point (integer) types.

Fields

§size: u32
§signed: bool
§bit_offset: u16
§bit_precision: u16
§

FloatingPoint

Class 1: Floating-point types.

Fields

§size: u32
§bit_offset: u16
§bit_precision: u16
§exponent_location: u8
§exponent_size: u8
§mantissa_location: u8
§mantissa_size: u8
§exponent_bias: u32
§

Time

Class 2: Time type (rarely used).

Fields

§size: u32
§bit_precision: u16
§

String

Class 3: Fixed-length string.

Fields

§size: u32
§

BitField

Class 4: Bit field.

Fields

§size: u32
§bit_offset: u16
§bit_precision: u16
§

Opaque

Class 5: Opaque data.

Fields

§size: u32
§tag: Vec<u8>
§

Compound

Class 6: Compound type.

Fields

§size: u32
§

Reference

Class 7: Reference type.

Fields

§size: u32
§ref_type: ReferenceType
§

Enumeration

Class 8: Enumeration type.

Fields

§size: u32
§base_type: Box<Datatype>
§members: Vec<EnumMember>
§

VariableLength

Class 9: Variable-length type.

Fields

§is_string: bool
§base_type: Box<Datatype>
§

Array

Class 10: Array type.

Fields

§base_type: Box<Datatype>
§dimensions: Vec<u32>

Implementations§

Source§

impl Datatype

Source

pub fn parse(data: &[u8]) -> Result<(Datatype, usize), FormatError>

Parse a datatype message from raw bytes.

Returns (Datatype, bytes_consumed) for recursive parsing.

Source

pub fn serialize(&self) -> Vec<u8>

Serialize datatype to HDF5 message bytes.

Source

pub fn type_size(&self) -> u32

Return the size in bytes of one element of this type.

Trait Implementations§

Source§

impl Clone for Datatype

Source§

fn clone(&self) -> Datatype

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Datatype

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Datatype

Source§

fn eq(&self, other: &Datatype) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Datatype

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.