#channel #bidirectional #linear #symmetric #handshake #time #unsafe

bin+lib oneshot-handshake

A crate providing a symmetric one time use channel type

6 releases

0.1.5 Jun 27, 2024
0.1.4 Jun 18, 2024

#674 in Asynchronous

46 downloads per month

MIT license

21KB
311 lines

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(())

No runtime deps