ConnectOpts

Struct ConnectOpts 

Source
pub struct ConnectOpts<'a> { /* private fields */ }
Expand description

Connection options, represented as a consuming builder. Used during connection request, translated to the CONNECT packet.

Implementations§

Source§

impl<'a> ConnectOpts<'a>

Source

pub fn new() -> Self

Creates a new ConnectOpts instance.

Source

pub fn client_identifier(self, val: &'a str) -> Self

Sets the client identifier.

Source

pub fn keep_alive(self, val: Duration) -> Self

Sets the session keep alive.

§Arguments

val - Duration value less than u16::MAX in seconds.

§Panics

When the duration in seconds is greater than u16::MAX.

Source

pub fn session_expiry_interval(self, val: Duration) -> Self

Sets the session expiry interval.

§Arguments

val - Duration value less than u32::MAX in seconds.

§Panics

When the duration in seconds is greater than u32::MAX.

Source

pub fn receive_maximum(self, val: u16) -> Self

Sets the maximum incoming QoS>0 publish messages handled at once.

§Arguments

val - value greater than 0

§Panics

When val equals 0.

Source

pub fn maximum_packet_size(self, val: u32) -> Self

Sets the maximum packet size (in bytes).

§Arguments

val - value greater than 0

§Panics

When val equals 0.

Source

pub fn topic_alias_maximum(self, val: u16) -> Self

Sets the maximum accepted value of topic alias.

Source

pub fn request_response_information(self, val: bool) -> Self

Requests the broker to return response information in ConnectRsp.

Source

pub fn request_problem_information(self, val: bool) -> Self

Requests the broker to return additional diagnostic data (reason string, user properties) in ConnectRsp.

Source

pub fn authentication_method(self, val: &'a str) -> Self

Sets the name of the authentication method used for extended authorization.

Source

pub fn authentication_data(self, val: &'a [u8]) -> Self

Sets the binary authentication data. Note that setting authentication data without authentication_method set will result in an error.

Source

pub fn user_property(self, (key, val): (&'a str, &'a str)) -> Self

Sets user properties as key-value pairs. Multiple user properties may be set.

Source

pub fn will_qos(self, val: QoS) -> Self

QoS used for will messages.

Source

pub fn will_retain(self, val: bool) -> Self

Retain for will messages.

Source

pub fn clean_start(self, val: bool) -> Self

Clears the session upon connection.

Source

pub fn will_delay_interval(self, val: Duration) -> Self

Sets delay before publishing will messages.

§Arguments

val - Duration value less than u32::MAX in seconds.

§Panics

When the duration in seconds is greater than u32::MAX.

Source

pub fn will_payload_format_indicator(self, val: bool) -> Self

Sets payload format indicator for will messages. Value false indicates that the will payload is in unspecified format. Value true indicates that the payload is UTF8 encoded character data.

Source

pub fn will_message_expiry_interval(self, val: Duration) -> Self

Sets the expiry interval of the will messages.

§Arguments

val - Duration value less than u32::MAX in seconds.

§Panics

When the duration in seconds is greater than u32::MAX.

Source

pub fn will_content_type(self, val: &'a str) -> Self

Sets the content type of will messages.

Source

pub fn will_response_topic(self, val: &'a str) -> Self

Sets the response topic for will messages.

Source

pub fn will_correlation_data(self, val: &'a [u8]) -> Self

Sets the correlation data for will messages.

Source

pub fn will_user_property(self, (key, val): (&'a str, &'a str)) -> Self

Sets user properties for will messages as key-value pairs. Multiple user properties may be set.

Source

pub fn will_topic(self, val: &'a str) -> Self

Sets the topic for will messages.

Source

pub fn will_payload(self, val: &'a [u8]) -> Self

Sets the binary payload for will messages.

Source

pub fn username(self, val: &'a str) -> Self

Sets the username for normal authorization.

Source

pub fn password(self, val: &'a [u8]) -> Self

Sets the password for normal authorization.

Trait Implementations§

Source§

impl<'a> Default for ConnectOpts<'a>

Source§

fn default() -> ConnectOpts<'a>

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

Auto Trait Implementations§

§

impl<'a> Freeze for ConnectOpts<'a>

§

impl<'a> RefUnwindSafe for ConnectOpts<'a>

§

impl<'a> Send for ConnectOpts<'a>

§

impl<'a> Sync for ConnectOpts<'a>

§

impl<'a> Unpin for ConnectOpts<'a>

§

impl<'a> UnwindSafe for ConnectOpts<'a>

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. 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.