#resume #stop #pause

halt

Provides functionality for pausing, stopping, and resuming iterators, readers, and writers

9 releases (3 stable)

2.0.1 May 15, 2020
2.0.0 Jan 24, 2020
1.0.0 Dec 18, 2019
0.5.1 Dec 6, 2019
0.5.0 Nov 28, 2019

#184 in Concurrency

48 downloads per month

MIT/Apache

9KB
180 lines

halt

Travis Crates.io Docs

Provides functionality for pausing, stopping, and resuming iterators, readers, and writers.

use std::{io, thread, time::Duration};

let mut halt = halt::new(io::repeat(0));
let remote = halt.remote();
thread::spawn(move || io::copy(&mut halt, &mut io::sink()).unwrap());

thread::sleep(Duration::from_secs(5));
remote.pause();
thread::sleep(Duration::from_secs(5));
remote.resume();
thread::sleep(Duration::from_secs(5));

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

No runtime deps