Skip to main content

build

Function build 

Source
pub fn build<F, S, R>(flavor: F) -> (S, R)
where F: Flavor, S: SenderType<Flavor = F> + NotCloneable, R: ReceiverType<Flavor = F> + NotCloneable,
Expand description

The generic builder for all spsc channel types.

Initialize sender and receiver types from a flavor type, you can let the compiler to infer the type according to return type signature. (the falvor might have different new() method, but the rest is the same.

ยงExamples

use crossfire::{*, spsc::*};
let (tx, rx): (Tx<_>, Rx<_>) = build::<List<i32>, _, _>(List::new());
let (tx, rx): (AsyncTx<One<usize>>, Rx<One<usize>>)  = build(One::new());