ConnAckPacket

Struct ConnAckPacket 

Source
pub struct ConnAckPacket {
    pub session_present: bool,
    pub reason_code: ReasonCode,
    pub properties: Properties,
    pub protocol_version: u8,
}
Expand description

MQTT CONNACK packet

Fields§

§session_present: bool

Session present flag

§reason_code: ReasonCode

Connect reason code

§properties: Properties

CONNACK properties (v5.0 only)

§protocol_version: u8

Protocol version (for encoding/decoding)

Implementations§

Source§

impl ConnAckPacket

Source

pub fn new(session_present: bool, reason_code: ReasonCode) -> Self

Creates a new CONNACK packet

Source

pub fn new_v311(session_present: bool, reason_code: ReasonCode) -> Self

Creates a new v3.1.1 CONNACK packet

Source

pub fn with_session_expiry_interval(self, interval: u32) -> Self

Sets the session expiry interval

Source

pub fn with_receive_maximum(self, max: u16) -> Self

Sets the receive maximum

Source

pub fn with_maximum_qos(self, qos: u8) -> Self

Sets the maximum QoS

Source

pub fn with_retain_available(self, available: bool) -> Self

Sets whether retain is available

Source

pub fn with_maximum_packet_size(self, size: u32) -> Self

Sets the maximum packet size

Source

pub fn with_assigned_client_id(self, id: String) -> Self

Sets the assigned client identifier

Source

pub fn with_topic_alias_maximum(self, max: u16) -> Self

Sets the topic alias maximum

Source

pub fn with_reason_string(self, reason: String) -> Self

Sets the reason string

Source

pub fn with_wildcard_subscription_available(self, available: bool) -> Self

Sets whether wildcards are available

Source

pub fn with_subscription_identifier_available(self, available: bool) -> Self

Sets whether subscription identifiers are available

Source

pub fn with_shared_subscription_available(self, available: bool) -> Self

Sets whether shared subscriptions are available

Source

pub fn with_server_keep_alive(self, keep_alive: u16) -> Self

Sets the server keep alive

Source

pub fn with_response_information(self, info: String) -> Self

Sets the response information

Source

pub fn with_server_reference(self, reference: String) -> Self

Sets the server reference

Source

pub fn with_authentication_method(self, method: String) -> Self

Sets the authentication method

Source

pub fn with_authentication_data(self, data: Vec<u8>) -> Self

Sets the authentication data

Source

pub fn with_user_property(self, key: String, value: String) -> Self

Adds a user property

Source

pub fn topic_alias_maximum(&self) -> Option<u16>

Gets the topic alias maximum from properties

Source

pub fn receive_maximum(&self) -> Option<u16>

Gets the receive maximum from properties

Source

pub fn maximum_packet_size(&self) -> Option<u32>

Gets the maximum packet size from properties

Trait Implementations§

Source§

impl Clone for ConnAckPacket

Source§

fn clone(&self) -> ConnAckPacket

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ConnAckPacket

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl MqttPacket for ConnAckPacket

Source§

fn packet_type(&self) -> PacketType

Returns the packet type
Source§

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>

Decodes the packet body (without fixed header) Read more
Source§

fn flags(&self) -> u8

Returns the fixed header flags
Source§

fn encode<B: BufMut>(&self, buf: &mut B) -> Result<()>

Encodes the complete packet (with fixed header) Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more