Struct Measured
pub struct Measured<'a, B: ?Sized> {
body: &'a B,
remaining: Vbi,
len: usize,
}Expand description
A packet whose Remaining Length fits in a Variable Byte Integer.
Measuring is the only step that can find a packet too large. Encoding a measured packet fails only if the sink does.
Fields§
§body: &'a B§remaining: Vbi§len: usizeImplementations§
§impl<'a, B: Body + ?Sized> Measured<'a, B>
impl<'a, B: Body + ?Sized> Measured<'a, B>
pub fn new(body: &'a B) -> Option<Self>
pub fn new(body: &'a B) -> Option<Self>
Measures body. Returns None if its length exceeds the Variable Byte
Integer maximum (Vbi::MAX_USIZE, about 256 MiB).
pub const fn encoded_len(&self) -> usize
pub const fn encoded_len(&self) -> usize
Returns the encoded length of the whole packet, fixed header included.
Trait Implementations§
Auto Trait Implementations§
impl<'a, B> Freeze for Measured<'a, B>
impl<'a, B> RefUnwindSafe for Measured<'a, B>
impl<'a, B> Send for Measured<'a, B>
impl<'a, B> Sync for Measured<'a, B>
impl<'a, B> Unpin for Measured<'a, B>
impl<'a, B> UnsafeUnpin for Measured<'a, B>
impl<'a, B> UnwindSafe for Measured<'a, B>
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