pub enum VarSeq {
Seq1(u8),
Seq2(u16),
Seq4(u32),
}
Expand description
A variably sized sequence number
NOTE: We use the standard PartialEq here, as we DO NOT treat sequence numbers of different lengths as equivalent.
We DO NOT impl Serialize/Deserialize for this type because we use non-postcard-compatible format (externally tagged)
Variants§
Seq1(u8)
A one byte sequence number
Seq2(u16)
A two byte sequence number
Seq4(u32)
A four byte sequence number
Implementations§
Source§impl VarSeq
impl VarSeq
Sourcepub fn resize(&mut self, kind: VarSeqKind)
pub fn resize(&mut self, kind: VarSeqKind)
Resize (up or down) to the requested kind.
When increasing size, the number is left-extended, e.g. 0x42u8
becomes
0x0000_0042u32
when resizing 1 -> 4.
When decreasing size, the number is truncated, e.g. 0xABCD_EF12u32
becomes 0x12u8
when resizing 4 -> 1.
Trait Implementations§
impl Copy for VarSeq
Auto Trait Implementations§
impl Freeze for VarSeq
impl RefUnwindSafe for VarSeq
impl Send for VarSeq
impl Sync for VarSeq
impl Unpin for VarSeq
impl UnwindSafe for VarSeq
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