pub struct SubAck { /* private fields */ }Expand description
The SubAck packet is sent by the server to the client to confirm receipt and
processing of a subscription request. It contains return codes indicating the
maximum QoS level granted for each requested subscription.
§Examples
use mqute_codec::protocol::QoS;
use mqute_codec::protocol::v4::{ReturnCode, SubAck};
// Single subscription
let suback = SubAck::new(1, vec![ReturnCode::Success(QoS::AtMostOnce)]);
let codes = suback.codes();
assert_eq!(codes[0], ReturnCode::Success(QoS::AtMostOnce));Implementations§
Source§impl SubAck
impl SubAck
Sourcepub fn new<I: IntoIterator<Item = ReturnCode>>(packet_id: u16, codes: I) -> Self
pub fn new<I: IntoIterator<Item = ReturnCode>>(packet_id: u16, codes: I) -> Self
Sourcepub fn codes(&self) -> Codes<ReturnCode>
pub fn codes(&self) -> Codes<ReturnCode>
Returns the subscription return codes
Each code indicates the result of the corresponding subscription request:
- Success variants contain the granted QoS level
- Failure indicates the subscription was not accepted
Trait Implementations§
impl Eq for SubAck
impl StructuralPartialEq for SubAck
Auto Trait Implementations§
impl Freeze for SubAck
impl RefUnwindSafe for SubAck
impl Send for SubAck
impl Sync for SubAck
impl Unpin for SubAck
impl UnwindSafe for SubAck
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