OpConfirm

Type Alias OpConfirm 

Source
pub type OpConfirm = Option<Receiver<Result<(), Error>>>;
Expand description

When a frame is sent, methods do not wait for the result, but they return OpConfirm type to let the sender get the result if required.

When the frame is sent with QoS “processed”, the Option contains Receiver

Example:

use busrt::QoS;

let result = client.send("target", payload, QoS::Processed).await.unwrap(); // get send result
let confirm = result.unwrap(); // get OpConfirm
let op_result = confirm.await.unwrap(); // receive the operation result
match op_result {
    Ok(_) => { /* the server has confirmed that it had processed the message */ }
    Err(e) => { /* the server has returned an error */ }
}

Aliased Type§

pub enum OpConfirm {
    None,
    Some(Receiver<Result<(), Error>>),
}

Variants§

§1.0.0

None

No value.

§1.0.0

Some(Receiver<Result<(), Error>>)

Some value of type T.