pub enum WireLen<T> {
Auto,
Set(T),
}Expand description
A wire length/count field: Auto-derived by default, or an explicit
Set override. See the module docs.
Variants§
Auto
Derive this length from its declared target when the message is encoded.
Set(T)
Write exactly this value — a deliberate override, or the value read on decode.
Implementations§
Source§impl<T> WireLen<T>
impl<T> WireLen<T>
Sourcepub fn auto() -> Self
pub fn auto() -> Self
An auto-deriving length (the default). Equivalent to WireLen::Auto.
Sourcepub fn set(value: T) -> Self
pub fn set(value: T) -> Self
A pinned, explicit length. Equivalent to WireLen::Set — the dual-use override.
Trait Implementations§
Source§impl<T: Bits> BitEncode for WireLen<T>
impl<T: Bits> BitEncode for WireLen<T>
Source§fn canonical_bit_encode<K: Sink>(&self, w: &mut K) -> Result<(), BitError>
fn canonical_bit_encode<K: Sink>(&self, w: &mut K) -> Result<(), BitError>
Encodes
self’s canonical form into any Sink: reserved fields as their
spec value, calc fields recomputed. Defaults to bit_encode
(verbatim == canonical) for messages with no reserved/calc field. Read moreSource§fn encode_mode(&self) -> EncodeMode
fn encode_mode(&self) -> EncodeMode
The form
EncodeExt::encode writes for this value. Defaults to
EncodeMode::Verbatim; a #[bin] message with a reserved/calc field carries a
settable encode_mode and overrides this to return it.impl<T: Copy> Copy for WireLen<T>
impl<T: Eq> Eq for WireLen<T>
Source§impl<T: Bits> FixedBitLen for WireLen<T>
A WireLen<T> occupies exactly T’s width, so it stays a fixed-width field (a DNS
header with WireLen<u16> counts is still 12 bytes).
impl<T: Bits> FixedBitLen for WireLen<T>
A WireLen<T> occupies exactly T’s width, so it stays a fixed-width field (a DNS
header with WireLen<u16> counts is still 12 bytes).
Source§impl<T: PartialEq> PartialEq for WireLen<T>
impl<T: PartialEq> PartialEq for WireLen<T>
impl<T: PartialEq> StructuralPartialEq for WireLen<T>
Auto Trait Implementations§
impl<T> Freeze for WireLen<T>where
T: Freeze,
impl<T> RefUnwindSafe for WireLen<T>where
T: RefUnwindSafe,
impl<T> Send for WireLen<T>where
T: Send,
impl<T> Sync for WireLen<T>where
T: Sync,
impl<T> Unpin for WireLen<T>where
T: Unpin,
impl<T> UnsafeUnpin for WireLen<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for WireLen<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DecodeWith<()> for Twhere
T: BitDecode,
impl<T> DecodeWith<()> for Twhere
T: BitDecode,
Source§impl<T> EncodeExt for Twhere
T: BitEncode,
impl<T> EncodeExt for Twhere
T: BitEncode,
Source§fn encode<W: Write>(&self, w: &mut W) -> Result<(), BitError>where
Self: Sized,
fn encode<W: Write>(&self, w: &mut W) -> Result<(), BitError>where
Self: Sized,
Available on crate feature
std only.Encodes
self to any std::io::Write (socket, file, Vec) in the value’s
encode_mode — verbatim unless its mode is set to
Canonical. For an unconditional choice, use the inherent
to_bytes (verbatim) / to_canonical_bytes (canonical) instead. Read more