pub struct Unsubscribe { /* private fields */ }Expand description
Represents an MQTT Unsubscribe packet.
§Example
use mqute_codec::protocol::TopicFilters;
use mqute_codec::protocol::v4::Unsubscribe;
let unsubscribe = Unsubscribe::new(1234, vec!["topic1", "topic2"]);
let filters = TopicFilters::new(vec!["topic1", "topic2"]);
assert_eq!(unsubscribe.packet_id(), 1234u16);
assert_eq!(unsubscribe.filters(), filters);Implementations§
Source§impl Unsubscribe
impl Unsubscribe
Sourcepub fn new<T: IntoIterator<Item: Into<String>>>(
packet_id: u16,
filters: T,
) -> Self
pub fn new<T: IntoIterator<Item: Into<String>>>( packet_id: u16, filters: T, ) -> Self
Creates a new Unsubscribe packet.
§Panics
Panics if:
packet_idis zero.- The topic filters are invalid according to MQTT topic naming rules.
Sourcepub fn filters(&self) -> TopicFilters
pub fn filters(&self) -> TopicFilters
Returns the list of topic filters to unsubscribe from.
Trait Implementations§
Source§impl Clone for Unsubscribe
impl Clone for Unsubscribe
Source§fn clone(&self) -> Unsubscribe
fn clone(&self) -> Unsubscribe
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 Unsubscribe
impl Debug for Unsubscribe
Source§impl Decode for Unsubscribe
impl Decode for Unsubscribe
Source§impl Encode for Unsubscribe
impl Encode for Unsubscribe
Source§impl PartialEq for Unsubscribe
impl PartialEq for Unsubscribe
impl Eq for Unsubscribe
impl StructuralPartialEq for Unsubscribe
Auto Trait Implementations§
impl Freeze for Unsubscribe
impl RefUnwindSafe for Unsubscribe
impl Send for Unsubscribe
impl Sync for Unsubscribe
impl Unpin for Unsubscribe
impl UnwindSafe for Unsubscribe
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<T> Encoded for Twhere
T: Encode,
impl<T> Encoded for Twhere
T: Encode,
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Calculates the total encoded length of the packet. Read more