Struct PublishToken
pub struct PublishToken {
progress_rx: Receiver<PublishProgress>,
result_rx: Receiver<Result<ReasonCode, Error>>,
}Expand description
A token returned by MqttClient::publish
that tracks the lifecycle of a publish operation.
Call progress() to inspect the current state, or
wait() to await the final acknowledgement.
Fields§
§progress_rx: Receiver<PublishProgress>§result_rx: Receiver<Result<ReasonCode, Error>>Implementations§
§impl PublishToken
impl PublishToken
pub(crate) const fn new( progress_rx: Receiver<PublishProgress>, result_rx: Receiver<Result<ReasonCode, Error>>, ) -> Self
pub fn progress(&self) -> PublishProgress
pub fn progress(&self) -> PublishProgress
Current progress of this publish operation.
pub async fn wait(self) -> Result<ReasonCode, Error>
pub async fn wait(self) -> Result<ReasonCode, Error>
Wait for the publish to be fully acknowledged.
QoS0: resolves when the bytes have been written.QoS1: resolves when PUBACK is received.QoS2: resolves when PUBCOMP is received.
§Errors
Returns Error::ConnectionClosed if the connection drops before
the operation completes.
Auto Trait Implementations§
impl Freeze for PublishToken
impl !RefUnwindSafe for PublishToken
impl Send for PublishToken
impl Sync for PublishToken
impl Unpin for PublishToken
impl !UnwindSafe for PublishToken
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