#[non_exhaustive]pub enum Container {
Word {
bits: u64,
prefix: u64,
prefix_value: Option<u128>,
endian: Endian,
order: BitOrder,
},
Bytes {
bytes: usize,
endian: Endian,
},
Words {
words: usize,
endian: Endian,
order: BitOrder,
},
}Expand description
How a layout addresses its fields.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Word
Word mode: bit fields in one container of whole bytes.
The container can be any size, but a field is at most 64 bits.
Fields
prefix: u64Leading bits the enclosing dispatch reads, which this layout’s fields do not cover.
Encode writes zeros there unless prefix_value is
set.
Bytes
Byte mode: byte-aligned scalars.
Words
Words mode: bit fields in a sequence of 16-bit words.
Implementations§
Source§impl Container
impl Container
Sourcepub fn word(bits: u64, endian: Endian, order: BitOrder) -> Self
pub fn word(bits: u64, endian: Endian, order: BitOrder) -> Self
A Container::Word with no prefix.
Sourcepub fn is_bit_addressed(&self) -> bool
pub fn is_bit_addressed(&self) -> bool
Whether fields are addressed in bits.
Sourcepub fn field_bits(&self) -> u64
pub fn field_bits(&self) -> u64
Sourcepub fn interior_boundary(&self) -> Option<u64>
pub fn interior_boundary(&self) -> Option<u64>
The word size in words mode (Some(16)), and None otherwise.
Sourcepub fn physical(&self, kind: &Kind, start: u64) -> u64
pub fn physical(&self, kind: &Kind, start: u64) -> u64
The wire position of a field declared at bit start, after applying BitOrder.
Under order = msb, scalar and codec fields are mirrored within their word. FIELDS and
STATED use this position. check_stated uses declared positions.
Sourcepub fn check_stated(
&self,
field: &str,
kind: &Kind,
stated: Stated,
declared: u64,
) -> Result<(), String>
pub fn check_stated( &self, field: &str, kind: &Kind, stated: Stated, declared: u64, ) -> Result<(), String>
Checks an #[at] position against the field’s declared position.
Under msb, #[at] counts in declared order, as a big-endian spec’s table does.
§Errors
The diagnostic text. Under msb it gives both positions.