Struct Subscription
pub struct Subscription {
pub(crate) filter: TopicFilterBuf,
pub(crate) options: SubscriptionOptions,
}Expand description
A topic filter with its associated subscription options.
Build one with Subscription::new and pass it to
MqttClient::subscribe or
SubscribeBuilder::and.
§Example
use finmqtt_client::tokio::Subscription;
use finmqtt_core::wire::QoS;
let sub = Subscription::new("sensors/#".parse().unwrap(), QoS::AtLeastOnce);
let sub = Subscription::new("sensors/#".parse().unwrap(), QoS::AtLeastOnce).no_local(true);Fields§
§filter: TopicFilterBuf§options: SubscriptionOptionsImplementations§
Source§impl Subscription
impl Subscription
Sourcepub const fn new(filter: TopicFilterBuf, qos: QoS) -> Subscription
pub const fn new(filter: TopicFilterBuf, qos: QoS) -> Subscription
Creates a new subscription for filter at qos.
Sourcepub const fn no_local(self, no_local: bool) -> Subscription
pub const fn no_local(self, no_local: bool) -> Subscription
When true, the broker will not forward messages published by this
client back to the same client on this subscription.
Sourcepub const fn retain_as_published(self, rap: bool) -> Subscription
pub const fn retain_as_published(self, rap: bool) -> Subscription
Sets the Retain As Published option (v5).
Sourcepub const fn retain_handling(self, rh: RetainHandling) -> Subscription
pub const fn retain_handling(self, rh: RetainHandling) -> Subscription
Sets the Retain Handling option (v5).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Subscription
impl RefUnwindSafe for Subscription
impl Send for Subscription
impl Sync for Subscription
impl Unpin for Subscription
impl UnsafeUnpin for Subscription
impl UnwindSafe for Subscription
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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