pub struct SubscriptionIdentifier { /* private fields */ }
Implementations§
Source§impl SubscriptionIdentifier
impl SubscriptionIdentifier
Sourcepub fn new(v: u32) -> Result<Self, MqttError>
pub fn new(v: u32) -> Result<Self, MqttError>
Creates a new variable integer property with the given value.
§Parameters
v
- The u32 value to set (encoded as variable byte integer)
§Returns
Ok(Self)
- Successfully created propertyErr(MqttError)
- If the value fails validation or is out of range
§Examples
ⓘ
let prop = SubscriptionIdentifier::new(42).unwrap();
Sourcepub fn parse(bytes: &[u8]) -> Result<(Self, usize), MqttError>
pub fn parse(bytes: &[u8]) -> Result<(Self, usize), MqttError>
Parses a variable integer property from the given byte slice.
§Parameters
bytes
- The byte slice to parse from
§Returns
Ok((Self, usize))
- The parsed property and number of bytes consumedErr(MqttError)
- If parsing fails or validation fails
§Examples
ⓘ
let data = &[0x2A]; // 42 as variable byte integer
let (prop, consumed) = SubscriptionIdentifier::parse(data).unwrap();
assert_eq!(consumed, 1);
Sourcepub fn to_buffers(&self) -> Vec<IoSlice<'_>>
pub fn to_buffers(&self) -> Vec<IoSlice<'_>>
Sourcepub fn to_continuous_buffer(&self) -> Vec<u8> ⓘ
pub fn to_continuous_buffer(&self) -> Vec<u8> ⓘ
Trait Implementations§
Source§impl Clone for SubscriptionIdentifier
impl Clone for SubscriptionIdentifier
Source§fn clone(&self) -> SubscriptionIdentifier
fn clone(&self) -> SubscriptionIdentifier
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 SubscriptionIdentifier
impl Debug for SubscriptionIdentifier
Source§impl Display for SubscriptionIdentifier
impl Display for SubscriptionIdentifier
Source§impl From<SubscriptionIdentifier> for Property
impl From<SubscriptionIdentifier> for Property
Source§fn from(v: SubscriptionIdentifier) -> Self
fn from(v: SubscriptionIdentifier) -> Self
Converts to this type from the input type.
Source§impl PartialEq for SubscriptionIdentifier
impl PartialEq for SubscriptionIdentifier
Source§impl Serialize for SubscriptionIdentifier
impl Serialize for SubscriptionIdentifier
impl Eq for SubscriptionIdentifier
impl StructuralPartialEq for SubscriptionIdentifier
Auto Trait Implementations§
impl Freeze for SubscriptionIdentifier
impl RefUnwindSafe for SubscriptionIdentifier
impl Send for SubscriptionIdentifier
impl Sync for SubscriptionIdentifier
impl Unpin for SubscriptionIdentifier
impl UnwindSafe for SubscriptionIdentifier
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<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.