pub struct PubAckPacket {
pub packet_id: u16,
pub reason_code: ReasonCode,
pub properties: Properties,
}Expand description
MQTT PUBACK packet (QoS 1 publish acknowledgment)
Fields§
§packet_id: u16Packet identifier
reason_code: ReasonCodeReason code
properties: PropertiesPUBACK properties (v5.0 only)
Implementations§
Source§impl PubAckPacket
impl PubAckPacket
Sourcepub fn new_with_reason(packet_id: u16, reason_code: ReasonCode) -> Self
pub fn new_with_reason(packet_id: u16, reason_code: ReasonCode) -> Self
Creates a new PUBACK packet with a reason code
Sourcepub fn with_reason_string(self, reason: String) -> Self
pub fn with_reason_string(self, reason: String) -> Self
Sets the reason string
Sourcepub fn with_user_property(self, key: String, value: String) -> Self
pub fn with_user_property(self, key: String, value: String) -> Self
Adds a user property
Sourcepub fn create_header(&self) -> AckPacketHeader
pub fn create_header(&self) -> AckPacketHeader
Creates a bebytes header for this packet
Sourcepub fn from_header(
header: AckPacketHeader,
properties: Properties,
) -> Result<Self>
pub fn from_header( header: AckPacketHeader, properties: Properties, ) -> Result<Self>
Creates a packet from a bebytes header and properties
§Errors
Returns an error if the reason code in the header is invalid
Trait Implementations§
Source§impl Clone for PubAckPacket
impl Clone for PubAckPacket
Source§fn clone(&self) -> PubAckPacket
fn clone(&self) -> PubAckPacket
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 PubAckPacket
impl Debug for PubAckPacket
Source§impl MqttPacket for PubAckPacket
impl MqttPacket for PubAckPacket
Source§fn packet_type(&self) -> PacketType
fn packet_type(&self) -> PacketType
Returns the packet type
Source§fn encode_body<B: BufMut>(&self, buf: &mut B) -> Result<()>
fn encode_body<B: BufMut>(&self, buf: &mut B) -> Result<()>
Encodes the packet body (without fixed header) Read more
Source§fn decode_body<B: Buf>(buf: &mut B, fixed_header: &FixedHeader) -> Result<Self>
fn decode_body<B: Buf>(buf: &mut B, fixed_header: &FixedHeader) -> Result<Self>
Decodes the packet body (without fixed header) Read more
Auto Trait Implementations§
impl Freeze for PubAckPacket
impl RefUnwindSafe for PubAckPacket
impl Send for PubAckPacket
impl Sync for PubAckPacket
impl Unpin for PubAckPacket
impl UnwindSafe for PubAckPacket
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