Crate oneshot_handshake

Source
Expand description

§Handshake

Symmetric one time use channels.

§Example

Allows each end of the handshake to send or receive information for bi-directional movement of data:

let (u, v) = oneshot_handshake::channel::<Box<str>>();
let combine = |x, y| format!("{} {}!", x, y);

'_task_a: {
    u.join("Handle Communication".into(), combine)
        .unwrap()
        .map(|s| println!("{}", s));
} // None

'_task_b: {
    v.join("Symmetrically".into(), combine)
        .unwrap()
        .map(|s| println!("{}", s));
} // Some(())

Structs§

Cancelled
An empty struct signalling cancellation for Handshake.
Handshake
A joint sender and receiver for a symmetric one time use channel.

Functions§

channel
Creates a symmetric one time use channel.
take
Pulls a value “now or never” garunteeing consumption of self. The channel will be cancelled if no value is set.