Struct Subscription
pub struct Subscription {
pub(crate) filter: TopicFilterBuf,
pub(crate) options: SubscriptionOptions,
}Expand description
A single topic filter with its associated subscription options.
Build one with Subscription::new and pass it to
MqttClient::subscribe or
SubscribeBuilder::and.
§Example
use finmqtt_core::wire::QoS;
use finmqtt_tokio::Subscription;
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§
§impl Subscription
impl Subscription
pub const fn new(filter: TopicFilterBuf, qos: QoS) -> Self
pub const fn new(filter: TopicFilterBuf, qos: QoS) -> Self
Creates a new subscription for filter at the given qos.
pub const fn no_local(self, no_local: bool) -> Self
pub const fn no_local(self, no_local: bool) -> Self
When true, the broker will not forward messages published by this
client back to the same client on this subscription.
pub const fn retain_as_published(self, rap: bool) -> Self
pub const fn retain_as_published(self, rap: bool) -> Self
Sets the Retain As Published option (v5).
pub const fn retain_handling(self, rh: RetainHandling) -> Self
pub const fn retain_handling(self, rh: RetainHandling) -> Self
Sets the Retain Handling option (v5).
Auto Trait Implementations§
impl Freeze for Subscription
impl RefUnwindSafe for Subscription
impl Send for Subscription
impl Sync for Subscription
impl Unpin 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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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