Skip to main content

channel

Function channel 

Source
pub fn channel(total: usize) -> (ProgressSender, Receiver<ProgressUpdate>)
Expand description

Creates a progress port: a ProgressSender fetch tasks report through, paired with the Receiver a driving adapter drains to render progress however it sees fit.

total is the total unit count (e.g. dependency count) every ProgressUpdate sent through the returned sender will carry.

ยงExamples

let (sender, mut receiver) = deps_engine::progress::channel(5);
sender.send(1);
sender.send(2);
assert_eq!(receiver.try_recv().unwrap().fetched, 1);
assert_eq!(receiver.try_recv().unwrap().fetched, 2);