Struct Unsubscribe
pub struct Unsubscribe<'a> {
pub packet_id: PacketId,
pub properties: &'a UnsubscribeProperties,
payload: &'a [u8],
}Expand description
UNSUBSCRIBE packet requesting removal of topic filter subscriptions.
Fields§
§packet_id: PacketIdPacket identifier.
properties: &'a UnsubscribePropertiesUNSUBSCRIBE properties.
payload: &'a [u8]Raw payload. Use Unsubscribe::topic_filters to iterate.
Implementations§
§impl<'a> Unsubscribe<'a>
impl<'a> Unsubscribe<'a>
pub const fn new(
packet_id: PacketId,
properties: &'a UnsubscribeProperties,
payload: &'a [u8],
) -> Self
pub const fn new( packet_id: PacketId, properties: &'a UnsubscribeProperties, payload: &'a [u8], ) -> Self
Create an UNSUBSCRIBE packet from pre-encoded topic filter payload bytes.
Use Writer to encode individual topic filters
(length-prefixed strings) into a buffer, then pass the written slice as
payload.
pub const fn topic_filters(&self) -> TopicFilterIter<'a> ⓘ
pub const fn topic_filters(&self) -> TopicFilterIter<'a> ⓘ
Iterate over the topic filters.
pub const fn encoded_len(&self) -> usize
pub const fn encoded_len(&self) -> usize
Returns the encoded size of the variable header + payload in bytes.
pub const fn encode(&self, w: &mut Writer<'_>) -> Result<(), EncodeError>
pub const fn encode(&self, w: &mut Writer<'_>) -> Result<(), EncodeError>
Encodes the UNSUBSCRIBE variable header + payload into the writer.
§Errors
Returns EncodeError::InsufficientSpace if the writer does not have
enough capacity.
pub const fn decode(r: &mut Reader<'a>) -> Result<Self, DecodeError>
pub const fn decode(r: &mut Reader<'a>) -> Result<Self, DecodeError>
Decodes an UNSUBSCRIBE packet from the reader.
§Errors
Returns DecodeError if the data is malformed, the packet ID is
zero, or properties contain disallowed IDs.
Trait Implementations§
§impl<'a> Clone for Unsubscribe<'a>
impl<'a> Clone for Unsubscribe<'a>
§fn clone(&self) -> Unsubscribe<'a>
fn clone(&self) -> Unsubscribe<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more