Skip to main content

SubscriptionOptions

Struct SubscriptionOptions 

Source
pub struct SubscriptionOptions {
    pub retain_handling: RetainHandling,
    pub retain_as_published: bool,
    pub no_local: bool,
    pub qos: QoS,
    pub subscription_identifier: Option<VarByteInt>,
}
Expand description

Options for subscription included for every topic.

Fields§

§retain_handling: RetainHandling

Serverside retain handling configuration for this subscription.

§retain_as_published: bool

If set to true, the server sets the retain flag of a PUBLISH packet matching this subscription to the retain flag value of the original publication. If set to false, the server sets the retain flag of a PUBLISH packet matching this subscription to false. This does not apply for retained messages sent directly after subscribing - these messages always have the retain flag set to 1.

§no_local: bool

If set to true, the server does not forward any publications matching this subscription to connections with client identifiers the same as the client identifier of this connection. If set to true on a shared subscription, a protocol error is triggered.

§qos: QoS

The maximum quality of service that the server can forward publications matching this subscription with to the client. A quality of service level lower than this can be granted by the server.

§subscription_identifier: Option<VarByteInt>

The subscription identifier of the subscription. The server will set subscription identifier properties in its PUBLISH packets to the values of all matching subscriptions with a subscription identifier.

Implementations§

Source§

impl Options

Source

pub const fn new() -> Self

Creates options with values coherent to the Default implementations of the fields and QoS::AtMostOnce.

Source

pub const fn qos(self, qos: QoS) -> Self

Sets the Quality of Service level.

Source

pub const fn at_least_once(self) -> Self

Sets the Quality of Service level to 1 (At Least Once).

Source

pub const fn exactly_once(self) -> Self

Sets the Quality of Service level to 1 (Exactly Once).

Source

pub const fn retain_handling(self, retain_handling: RetainHandling) -> Self

Sets the serverside retain handling configuration for this subscription.

Source

pub const fn retain_as_published(self) -> Self

Sets the retain as published flag to true.

Source

pub const fn no_local(self) -> Self

Sets the no local flag to true.

Source

pub const fn subscription_identifier( self, subscription_identifier: VarByteInt, ) -> Self

Sets the subscription identifier property.

Trait Implementations§

Source§

impl Clone for Options

Source§

fn clone(&self) -> Options

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 Options

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
Source§

impl Copy for Options

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