Struct Vbi
pub struct Vbi(u32);Expand description
Variable Byte Integer (VBI) as defined in MQTT v5 §1.5.5.
Tuple Fields§
§0: u32Implementations§
§impl Vbi
impl Vbi
pub const MIN: Self
pub const MIN: Self
The minimum value.
pub const MAX: Self
pub const MAX: Self
The maximum value.
pub(crate) const fn from_validated(value: u32) -> Self
pub(crate) const fn from_validated(value: u32) -> Self
Wraps value, which the caller has already checked against
Vbi::MAX.
pub const fn new(value: u32) -> Option<Self>
pub const fn new(value: u32) -> Option<Self>
Creates a new VBI from value, returning None if the value is
out of range.
pub const fn from_usize(value: usize) -> Option<Self>
pub const fn from_usize(value: usize) -> Option<Self>
Creates a new VBI from a usize, returning None if the value is out of
range.
pub const fn encoded_len(self) -> usize
pub const fn encoded_len(self) -> usize
Returns the number of bytes needed to encode this VBI.
Trait Implementations§
impl Copy for Vbi
impl Eq for Vbi
§impl Ord for Vbi
impl Ord for Vbi
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
§impl PartialOrd for Vbi
impl PartialOrd for Vbi
impl StructuralPartialEq for Vbi
Auto Trait Implementations§
impl Freeze for Vbi
impl RefUnwindSafe for Vbi
impl Send for Vbi
impl Sync for Vbi
impl Unpin for Vbi
impl UnsafeUnpin for Vbi
impl UnwindSafe for Vbi
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