Struct Subscribe
pub struct Subscribe<'a> {
pub packet_id: PacketId,
pub properties: &'a SubscribeProperties,
pub subscriptions: &'a Subscriptions,
}Expand description
SUBSCRIBE packet requesting topic filter subscriptions.
Fields§
§packet_id: PacketIdPacket identifier.
properties: &'a SubscribePropertiesSUBSCRIBE properties.
subscriptions: &'a SubscriptionsSubscription entries in this packet.
Implementations§
§impl<'a> Subscribe<'a>
impl<'a> Subscribe<'a>
pub const fn new(
packet_id: PacketId,
properties: &'a SubscribeProperties,
subscriptions: &'a Subscriptions,
) -> Self
pub const fn new( packet_id: PacketId, properties: &'a SubscribeProperties, subscriptions: &'a Subscriptions, ) -> Self
Creates a SUBSCRIBE packet from a subscription payload.
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 SUBSCRIBE 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 a SUBSCRIBE packet from the reader.
§Errors
Returns DecodeError if the data is malformed, the packet ID is
zero, properties contain disallowed IDs, or the payload is invalid.
Trait Implementations§
impl<'a> Eq for Subscribe<'a>
impl<'a> StructuralPartialEq for Subscribe<'a>
Auto Trait Implementations§
impl<'a> Freeze for Subscribe<'a>
impl<'a> RefUnwindSafe for Subscribe<'a>
impl<'a> Send for Subscribe<'a>
impl<'a> Sync for Subscribe<'a>
impl<'a> Unpin for Subscribe<'a>
impl<'a> UnwindSafe for Subscribe<'a>
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