Trait binary_layout::SizedFieldMetadata[][src]

pub trait SizedFieldMetadata {
    const SIZE: usize;
}

This trait offers access to the metadata of a sized field in a layout. Sized fields are all fields with a defined size. This is almost all fields. The only exception is an unsized array field that can be used to match tail data, i.e. any data at the end of the storage after all other fields were defined and until the storage ends.

Associated Constants

const SIZE: usize[src]

The size of the field in the layout.

Example

use binary_layout::prelude::*;

define_layout!(my_layout, LittleEndian, {
  field1: u16,
  field2: i32,
  field3: u8,
});

fn main() {
    assert_eq!(2, my_layout::field1::SIZE);
    assert_eq!(4, my_layout::field2::SIZE);
    assert_eq!(1, my_layout::field3::SIZE);
}
Loading content...

Implementors

impl<T: FieldSize, E: Endianness, const OFFSET_: usize> SizedFieldMetadata for Field<T, E, OFFSET_>[src]

Loading content...