Expand description
A one-shot channel is used for sending a single message between
asynchronous tasks. The channel
function is used to create a
Sender
and Receiver
handle pair that form the channel.
The Sender
handle is used by the producer to send the value.
The Receiver
handle is used by the consumer to receive the value.
Each handle can be used on separate fiber.
Since the send
method is not async it can be used from non-async code.
Example
use tarantool::fiber::r#async::oneshot;
use tarantool::fiber;
let (tx, rx) = oneshot::channel::<i32>();
tx.send(56);
let value = fiber::block_on(rx);
If the sender is dropped without sending, the receiver will fail with
super::RecvError
:
Structs
Functions
Creates a new one-shot channel for sending single values across asynchronous
tasks.