pub struct Format {
pub store: StoreFormat,
pub order: OrderFormat,
}
Expand description
A description of the format used to SCALE encode some bits.
Fields
store: StoreFormat
The StoreFormat
defines the size of each chunk that’s written (eg u8, u16 etc).
order: OrderFormat
The OrderFormat
determines the order in which we write bits to the store type;
do we write to the least significant bit first and work up, or write to the most
significant byte first and work down.
Implementations
sourceimpl Format
impl Format
sourcepub fn new(store: StoreFormat, order: OrderFormat) -> Self
pub fn new(store: StoreFormat, order: OrderFormat) -> Self
Define a new format by providing a store and order.
Example
use scale_bits::scale::format::{ Format, StoreFormat, OrderFormat };
let format = Format::new(StoreFormat::U8, OrderFormat::Lsb0);
sourcepub fn from_metadata(
ty: &TypeDefBitSequence<PortableForm>,
types: &PortableRegistry
) -> Result<Format, FromMetadataError>
pub fn from_metadata(
ty: &TypeDefBitSequence<PortableForm>,
types: &PortableRegistry
) -> Result<Format, FromMetadataError>
Use metadata to obtain details about the format.
Trait Implementations
impl Copy for Format
impl Eq for Format
impl StructuralEq for Format
impl StructuralPartialEq for Format
Auto Trait Implementations
impl RefUnwindSafe for Format
impl Send for Format
impl Sync for Format
impl Unpin for Format
impl UnwindSafe for Format
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more