pub struct VariableByteInteger { /* private fields */ }
Expand description
MQTT Variable Byte Integer representation with pre-encoded byte buffer.
Implementations§
Source§impl VariableByteInteger
impl VariableByteInteger
pub const MAX: u32 = 268_435_455u32
Sourcepub fn from_u32(value: u32) -> Option<Self>
pub fn from_u32(value: u32) -> Option<Self>
Encode a u32
into 1-4 bytes, return None
if too large.
Sourcepub fn to_buffers(&self) -> Vec<IoSlice<'_>>
pub fn to_buffers(&self) -> Vec<IoSlice<'_>>
For scatter-gather I/O.
Sourcepub fn decode_stream(buf: &[u8]) -> DecodeResult<Self>
pub fn decode_stream(buf: &[u8]) -> DecodeResult<Self>
Streaming decode: if enough bytes, returns (vbi, consumed)
,
if too few bytes then Incomplete
, else error.
Trait Implementations§
Source§impl Clone for VariableByteInteger
impl Clone for VariableByteInteger
Source§fn clone(&self) -> VariableByteInteger
fn clone(&self) -> VariableByteInteger
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for VariableByteInteger
impl Debug for VariableByteInteger
Source§impl<'de> Deserialize<'de> for VariableByteInteger
impl<'de> Deserialize<'de> for VariableByteInteger
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for VariableByteInteger
impl Display for VariableByteInteger
Source§impl From<VariableByteInteger> for u32
impl From<VariableByteInteger> for u32
Source§fn from(vbi: VariableByteInteger) -> Self
fn from(vbi: VariableByteInteger) -> Self
Converts to this type from the input type.
Source§impl PartialEq for VariableByteInteger
impl PartialEq for VariableByteInteger
Source§impl PropertySize for VariableByteInteger
Implementation of PropertySize for VariableByteInteger values
Variable byte integers use 1-4 bytes depending on the value
impl PropertySize for VariableByteInteger
Implementation of PropertySize for VariableByteInteger values Variable byte integers use 1-4 bytes depending on the value
Source§impl Serialize for VariableByteInteger
impl Serialize for VariableByteInteger
Source§impl TryFrom<u32> for VariableByteInteger
impl TryFrom<u32> for VariableByteInteger
impl Eq for VariableByteInteger
impl StructuralPartialEq for VariableByteInteger
Auto Trait Implementations§
impl Freeze for VariableByteInteger
impl RefUnwindSafe for VariableByteInteger
impl Send for VariableByteInteger
impl Sync for VariableByteInteger
impl Unpin for VariableByteInteger
impl UnwindSafe for VariableByteInteger
Blanket Implementations§
Source§impl<T> AsConcrete<T> for T
impl<T> AsConcrete<T> for T
fn as_concrete(&self) -> Option<&T>
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.