Struct paho_mqtt::properties::Properties
source · pub struct Properties { /* private fields */ }
Expand description
A collection of MQTT v5 properties.
This is a collection of properties that can be added to outgoing packets or retrieved from incoming packets.
Implementations§
source§impl Properties
impl Properties
sourcepub fn from_c_struct(cprops: &MQTTProperties) -> Self
pub fn from_c_struct(cprops: &MQTTProperties) -> Self
Creates a set of properties from an underlying C struct.
This does a deep copy of the properties in the C lib and then keeps the copy.
sourcepub fn byte_len(&self) -> usize
pub fn byte_len(&self) -> usize
Gets the number of bytes required for the serialized list on the wire.
sourcepub fn push_val<T>(&mut self, code: PropertyCode, val: T) -> Result<()>where
T: Any + 'static,
pub fn push_val<T>(&mut self, code: PropertyCode, val: T) -> Result<()>where T: Any + 'static,
Adds a property to the collection given the property code and value.
sourcepub fn push_byte(&mut self, code: PropertyCode, val: u8) -> Result<()>
pub fn push_byte(&mut self, code: PropertyCode, val: u8) -> Result<()>
Adds an single-byte property to the collection.
sourcepub fn push_u16(&mut self, code: PropertyCode, val: u16) -> Result<()>
pub fn push_u16(&mut self, code: PropertyCode, val: u16) -> Result<()>
Adds an two-byte integer property to the collection.
sourcepub fn push_u32(&mut self, code: PropertyCode, val: u32) -> Result<()>
pub fn push_u32(&mut self, code: PropertyCode, val: u32) -> Result<()>
Adds a four-byte integer property to the collection.
sourcepub fn push_int(&mut self, code: PropertyCode, val: i32) -> Result<()>
pub fn push_int(&mut self, code: PropertyCode, val: i32) -> Result<()>
Adds an integer property to the collection.
This works for any integer type.
sourcepub fn push_binary<V>(&mut self, code: PropertyCode, bin: V) -> Result<()>where
V: Into<Binary>,
pub fn push_binary<V>(&mut self, code: PropertyCode, bin: V) -> Result<()>where V: Into<Binary>,
Adds a binary property to the collection
sourcepub fn push_string(&mut self, code: PropertyCode, s: &str) -> Result<()>
pub fn push_string(&mut self, code: PropertyCode, s: &str) -> Result<()>
Adds a string property to the collection
sourcepub fn push_string_pair(
&mut self,
code: PropertyCode,
key: &str,
val: &str
) -> Result<()>
pub fn push_string_pair( &mut self, code: PropertyCode, key: &str, val: &str ) -> Result<()>
Adds a string pair property to the collection
sourcepub fn get(&self, code: PropertyCode) -> Option<Property>
pub fn get(&self, code: PropertyCode) -> Option<Property>
Gets a property instance
sourcepub fn get_at(&self, code: PropertyCode, idx: usize) -> Option<Property>
pub fn get_at(&self, code: PropertyCode, idx: usize) -> Option<Property>
Gets a property instance when there are possibly multiple values.
sourcepub fn iter(&self, code: PropertyCode) -> PropertyIterator<'_> ⓘ
pub fn iter(&self, code: PropertyCode) -> PropertyIterator<'_> ⓘ
Gets an iterator for a property instance
sourcepub fn get_val_at<T>(&self, code: PropertyCode, idx: usize) -> Option<T>where
T: Any + 'static + Send + Default,
pub fn get_val_at<T>(&self, code: PropertyCode, idx: usize) -> Option<T>where T: Any + 'static + Send + Default,
Gets a value from the collection when there may be more than one for the code.
sourcepub fn get_val<T>(&self, code: PropertyCode) -> Option<T>where
T: Any + 'static + Send + Default,
pub fn get_val<T>(&self, code: PropertyCode) -> Option<T>where T: Any + 'static + Send + Default,
Gets a value from the collection when there may be more than one for the code.
sourcepub fn get_int(&self, code: PropertyCode) -> Option<i32>
pub fn get_int(&self, code: PropertyCode) -> Option<i32>
Gets an integer value of a specific property.
sourcepub fn get_int_at(&self, code: PropertyCode, idx: usize) -> Option<i32>
pub fn get_int_at(&self, code: PropertyCode, idx: usize) -> Option<i32>
Gets an integer value of a specific value when there may be more than one.
sourcepub fn get_binary(&self, code: PropertyCode) -> Option<Binary>
pub fn get_binary(&self, code: PropertyCode) -> Option<Binary>
Gets a binary value of a specific property.
sourcepub fn get_binary_at(&self, code: PropertyCode, idx: usize) -> Option<Binary>
pub fn get_binary_at(&self, code: PropertyCode, idx: usize) -> Option<Binary>
Gets a binary value of a specific value when there may be more than one.
sourcepub fn get_string(&self, code: PropertyCode) -> Option<String>
pub fn get_string(&self, code: PropertyCode) -> Option<String>
Gets a string value of a specific property.
sourcepub fn get_string_at(&self, code: PropertyCode, idx: usize) -> Option<String>
pub fn get_string_at(&self, code: PropertyCode, idx: usize) -> Option<String>
Gets a binary value of a specific value when there may be more than one.
sourcepub fn get_string_pair(&self, code: PropertyCode) -> Option<(String, String)>
pub fn get_string_pair(&self, code: PropertyCode) -> Option<(String, String)>
Gets a string pair for a specific property.
sourcepub fn get_string_pair_at(
&self,
code: PropertyCode,
idx: usize
) -> Option<(String, String)>
pub fn get_string_pair_at( &self, code: PropertyCode, idx: usize ) -> Option<(String, String)>
Gets a string pair for a specific property when there may be more than one.
sourcepub fn user_iter(&self) -> StringPairIterator<'_> ⓘ
pub fn user_iter(&self) -> StringPairIterator<'_> ⓘ
Gets an iterator into the user property string pairs.
sourcepub fn find_user_property(&self, key: &str) -> Option<String>
pub fn find_user_property(&self, key: &str) -> Option<String>
Searches for the specified key in the user properties and returns the value if found.