Skip to main content

ConnectOptions

Struct ConnectOptions 

Source
pub struct ConnectOptions<'c> {
    pub clean_start: bool,
    pub keep_alive: KeepAlive,
    pub session_expiry_interval: SessionExpiryInterval,
    pub maximum_packet_size: MaximumPacketSize,
    pub request_response_information: bool,
    pub user_name: Option<MqttString<'c>>,
    pub password: Option<MqttBinary<'c>>,
    pub will: Option<WillOptions<'c>>,
}
Expand description

Options for a connection.

Fields§

§clean_start: bool

If set to true, a new session is started. If set to false, an existing session is continued.

§keep_alive: KeepAlive

The setting of the keep alive the client wishes. Can be set to a different value by the server.

§session_expiry_interval: SessionExpiryInterval

The setting of the session expiry interval the server wishes. Can be set to a different value by the server.

§maximum_packet_size: MaximumPacketSize

The maximum packet size that the client is willing to accept

§request_response_information: bool

When set to true, the broker may return response information used to construct response topics.

§user_name: Option<MqttString<'c>>

The user name the client wishes to authenticate with.

§password: Option<MqttBinary<'c>>

The password the client wishes to perform basic authentication with.

§will: Option<WillOptions<'c>>

The will configuration for the session of the connection.

Implementations§

Source§

impl<'c> Options<'c>

Source

pub const fn new() -> Self

Creates new connect options with no clean start, infinite keep alive and session expiry immediately after disconnecting.

Source

pub const fn clean_start(self) -> Self

Sets the clean start flag to true.

Source

pub const fn keep_alive(self, keep_alive: KeepAlive) -> Self

Sets the desired keep alive of the connection.

Source

pub const fn session_expiry_interval( self, interval: SessionExpiryInterval, ) -> Self

Sets the desired session expiry interval of the connection.

Source

pub const fn maximum_packet_size( self, maximum_packet_size: NonZero<u32>, ) -> Self

Sets the maximum packet size as a limit in bytes. A value less than 2 does not make sense.

Source

pub const fn request_response_information(self) -> Self

Sets the request response information property to true prompting the server to return a response information property to construct response topics.

Source

pub fn user_name(self, user_name: MqttString<'c>) -> Self

Sets the user name.

Source

pub fn password(self, password: MqttBinary<'c>) -> Self

Sets the password.

Source

pub fn will(self, will: WillOptions<'c>) -> Self

Sets the will.

Trait Implementations§

Source§

impl<'c> Clone for Options<'c>

Source§

fn clone(&self) -> Options<'c>

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<'c> Debug for Options<'c>

Source§

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

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

impl Default for Options<'_>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'c> Freeze for Options<'c>

§

impl<'c> RefUnwindSafe for Options<'c>

§

impl<'c> Send for Options<'c>

§

impl<'c> Sync for Options<'c>

§

impl<'c> Unpin for Options<'c>

§

impl<'c> UnsafeUnpin for Options<'c>

§

impl<'c> UnwindSafe for Options<'c>

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, 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.