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>
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).
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 verbatim to any std::io::Write (socket, file, Vec) — exactly
what’s stored. For the canonical form, encode self.to_canonical().encode(&mut w), or
use the inherent to_bytes (verbatim) / to_canonical_bytes (canonical) instead. Read more