Type Definition elbus::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 elbus::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 */ }
}