Struct SubscribeBuilder
pub struct SubscribeBuilder {
cmd_tx: Sender<Command>,
subscriptions: Vec<Subscription>,
subscription_id: Option<NonZeroVbi>,
}Expand description
Builder for subscribing to one or more topic filters.
Obtained via MqttClient::subscribe.
Call send to get a SubscribeFuture that can be awaited
for SUBACK, or converted to a QueuedSubscribeFuture via
SubscribeFuture::queued to resolve as soon as the subscription is
recorded locally.
Fields§
§cmd_tx: Sender<Command>§subscriptions: Vec<Subscription>§subscription_id: Option<NonZeroVbi>Implementations§
Source§impl SubscribeBuilder
impl SubscribeBuilder
Sourcepub fn and(self, subscription: Subscription) -> SubscribeBuilder
pub fn and(self, subscription: Subscription) -> SubscribeBuilder
Adds an additional subscription to this batch.
All subscriptions in the batch are sent in one SUBSCRIBE packet.
Sourcepub const fn subscription_id(self, id: NonZeroVbi) -> SubscribeBuilder
pub const fn subscription_id(self, id: NonZeroVbi) -> SubscribeBuilder
Assigns a Subscription Identifier (v5, property 0x0B).
The broker echoes this identifier in PUBLISH packets that match any filter in this batch.
Sourcepub fn send(self) -> SubscribeFuture ⓘ
pub fn send(self) -> SubscribeFuture ⓘ
Returns a SubscribeFuture that drives the SUBSCRIBE to completion.
No work is done until the future is first polled. A permit on the
command channel is reserved before the Command is built, so memory
is only allocated once back-pressure is released.
Await the future to wait for SUBACK, or call
SubscribeFuture::queued to convert it into a
QueuedSubscribeFuture that resolves as soon as the subscription is
recorded locally.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SubscribeBuilder
impl RefUnwindSafe for SubscribeBuilder
impl Send for SubscribeBuilder
impl Sync for SubscribeBuilder
impl Unpin for SubscribeBuilder
impl UnsafeUnpin for SubscribeBuilder
impl UnwindSafe for SubscribeBuilder
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
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> ⓘ
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> ⓘ
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