pub struct Properties { /* private fields */ }Expand description
Container for MQTT v5.0 properties
Implementations§
Source§impl Properties
impl Properties
Sourcepub fn add(&mut self, id: PropertyId, value: PropertyValue) -> Result<()>
pub fn add(&mut self, id: PropertyId, value: PropertyValue) -> Result<()>
Sourcepub fn get(&self, id: PropertyId) -> Option<&PropertyValue>
pub fn get(&self, id: PropertyId) -> Option<&PropertyValue>
Gets a single property value
Sourcepub fn get_all(&self, id: PropertyId) -> Option<&[PropertyValue]>
pub fn get_all(&self, id: PropertyId) -> Option<&[PropertyValue]>
Gets all values for a property (for properties that allow multiple values)
Sourcepub fn contains(&self, id: PropertyId) -> bool
pub fn contains(&self, id: PropertyId) -> bool
Checks if a property is present
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of properties (counting multi-value properties as one)
Sourcepub fn iter(&self) -> impl Iterator<Item = (PropertyId, &PropertyValue)> + '_
pub fn iter(&self) -> impl Iterator<Item = (PropertyId, &PropertyValue)> + '_
Iterates over all properties and their values
Sourcepub fn encoded_len(&self) -> usize
pub fn encoded_len(&self) -> usize
Calculates the encoded length of all properties (including length prefix)
Sourcepub fn set_payload_format_indicator(&mut self, is_utf8: bool)
pub fn set_payload_format_indicator(&mut self, is_utf8: bool)
Sets the payload format indicator (0 = unspecified bytes, 1 = UTF-8)
Sourcepub fn set_message_expiry_interval(&mut self, seconds: u32)
pub fn set_message_expiry_interval(&mut self, seconds: u32)
Sets the message expiry interval in seconds
Sourcepub fn get_message_expiry_interval(&self) -> Option<u32>
pub fn get_message_expiry_interval(&self) -> Option<u32>
Gets the message expiry interval in seconds
Sourcepub fn set_topic_alias(&mut self, alias: u16)
pub fn set_topic_alias(&mut self, alias: u16)
Sets the topic alias
Sourcepub fn get_topic_alias(&self) -> Option<u16>
pub fn get_topic_alias(&self) -> Option<u16>
Gets the topic alias
Sourcepub fn set_response_topic(&mut self, topic: String)
pub fn set_response_topic(&mut self, topic: String)
Sets the response topic
Sourcepub fn set_correlation_data(&mut self, data: Bytes)
pub fn set_correlation_data(&mut self, data: Bytes)
Sets the correlation data
Sourcepub fn add_user_property(&mut self, key: String, value: String)
pub fn add_user_property(&mut self, key: String, value: String)
Adds a user property (can be called multiple times)
Sourcepub fn set_subscription_identifier(&mut self, id: u32)
pub fn set_subscription_identifier(&mut self, id: u32)
Sets the subscription identifier
pub fn get_subscription_identifier(&self) -> Option<u32>
Sourcepub fn set_session_expiry_interval(&mut self, seconds: u32)
pub fn set_session_expiry_interval(&mut self, seconds: u32)
Sets the session expiry interval
Sourcepub fn get_session_expiry_interval(&self) -> Option<u32>
pub fn get_session_expiry_interval(&self) -> Option<u32>
Gets the session expiry interval
Sourcepub fn set_assigned_client_identifier(&mut self, id: String)
pub fn set_assigned_client_identifier(&mut self, id: String)
Sets the assigned client identifier
Sourcepub fn set_server_keep_alive(&mut self, seconds: u16)
pub fn set_server_keep_alive(&mut self, seconds: u16)
Sets the server keep alive
Sourcepub fn set_authentication_method(&mut self, method: String)
pub fn set_authentication_method(&mut self, method: String)
Sets the authentication method
Sourcepub fn set_authentication_data(&mut self, data: Bytes)
pub fn set_authentication_data(&mut self, data: Bytes)
Sets the authentication data
pub fn get_authentication_method(&self) -> Option<&String>
pub fn get_authentication_data(&self) -> Option<&[u8]>
Sourcepub fn set_request_problem_information(&mut self, request: bool)
pub fn set_request_problem_information(&mut self, request: bool)
Sets request problem information
Sourcepub fn get_request_problem_information(&self) -> Option<bool>
pub fn get_request_problem_information(&self) -> Option<bool>
Gets request problem information
Sourcepub fn set_will_delay_interval(&mut self, seconds: u32)
pub fn set_will_delay_interval(&mut self, seconds: u32)
Sets the will delay interval
Sourcepub fn set_request_response_information(&mut self, request: bool)
pub fn set_request_response_information(&mut self, request: bool)
Sets request response information
Sourcepub fn get_request_response_information(&self) -> Option<bool>
pub fn get_request_response_information(&self) -> Option<bool>
Gets request response information
Sourcepub fn set_response_information(&mut self, info: String)
pub fn set_response_information(&mut self, info: String)
Sets the response information
Sourcepub fn set_server_reference(&mut self, reference: String)
pub fn set_server_reference(&mut self, reference: String)
Sets the server reference
Sourcepub fn set_reason_string(&mut self, reason: String)
pub fn set_reason_string(&mut self, reason: String)
Sets the reason string
Sourcepub fn set_receive_maximum(&mut self, max: u16)
pub fn set_receive_maximum(&mut self, max: u16)
Sets the receive maximum
Sourcepub fn get_receive_maximum(&self) -> Option<u16>
pub fn get_receive_maximum(&self) -> Option<u16>
Gets the receive maximum
Sourcepub fn set_topic_alias_maximum(&mut self, max: u16)
pub fn set_topic_alias_maximum(&mut self, max: u16)
Sets the topic alias maximum
Sourcepub fn get_topic_alias_maximum(&self) -> Option<u16>
pub fn get_topic_alias_maximum(&self) -> Option<u16>
Gets the topic alias maximum
Sourcepub fn set_maximum_qos(&mut self, qos: u8)
pub fn set_maximum_qos(&mut self, qos: u8)
Sets the maximum QoS
Sourcepub fn set_retain_available(&mut self, available: bool)
pub fn set_retain_available(&mut self, available: bool)
Sets retain available
Sourcepub fn set_maximum_packet_size(&mut self, size: u32)
pub fn set_maximum_packet_size(&mut self, size: u32)
Sets the maximum packet size
Sourcepub fn set_wildcard_subscription_available(&mut self, available: bool)
pub fn set_wildcard_subscription_available(&mut self, available: bool)
Sets wildcard subscription available
Sourcepub fn set_subscription_identifier_available(&mut self, available: bool)
pub fn set_subscription_identifier_available(&mut self, available: bool)
Sets subscription identifier available
Sets shared subscription available
Sourcepub fn get_maximum_qos(&self) -> Option<u8>
pub fn get_maximum_qos(&self) -> Option<u8>
Gets the maximum QoS
Sourcepub fn set_content_type(&mut self, content_type: String)
pub fn set_content_type(&mut self, content_type: String)
Sets the content type
Trait Implementations§
Source§impl Clone for Properties
impl Clone for Properties
Source§fn clone(&self) -> Properties
fn clone(&self) -> Properties
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more