#[non_exhaustive]pub enum Kind {
Scalar(Scalar),
Array(Scalar, Vec<usize>),
Codec {
ty: String,
bits: u64,
},
Nested {
ty: String,
bytes: usize,
},
NestedArray {
ty: String,
bytes: usize,
len: usize,
},
Var {
ty: String,
},
Msg {
ty: String,
boxed: bool,
with: Vec<String>,
},
Checksum {
repr: Scalar,
algorithm: String,
over: Coverage,
},
Text {
len: Len,
codec: Option<String>,
},
}Expand description
A field’s type and width.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Scalar(Scalar)
A scalar.
Array(Scalar, Vec<usize>)
An array of scalars, outermost length first: [[f64; 3]; 2] is [2, 3].
Codec
A FieldCodec type.
Nested
A nested layout.
NestedArray
An array of nested layouts.
Fields
Var
A VarCodec type, whose size is read from the wire.
Msg
A nested MessageDef.
Fields
Checksum
A #[checksum(..)] field in a fixed layout.
Messages use Segment::Checksum.
Fields
Text
A String.
Implementations§
Source§impl Kind
impl Kind
Sourcepub fn bytes(n: usize) -> Self
pub fn bytes(n: usize) -> Self
[u8; n].
Same as Array(Scalar::U(8), vec![n]), but describes as raw bytes.
Sourcepub fn checksum(repr: Scalar, algorithm: &str, over: Coverage) -> Self
pub fn checksum(repr: Scalar, algorithm: &str, over: Coverage) -> Self
#[checksum(algorithm, over = ..)].
Sourcepub fn bits(&self) -> Option<u64>
pub fn bits(&self) -> Option<u64>
The width in bits, or None if the size is read from the wire.
Sourcepub fn is_integer(&self) -> bool
pub fn is_integer(&self) -> bool
Whether a count, length or offset can read its number from this field.
Trait Implementations§
impl Eq for Kind
impl StructuralPartialEq for Kind
Auto Trait Implementations§
impl Freeze for Kind
impl RefUnwindSafe for Kind
impl Send for Kind
impl Sync for Kind
impl Unpin for Kind
impl UnsafeUnpin for Kind
impl UnwindSafe for Kind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more