Expand description
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));
Structs§
- Halt
- A wrapper that makes it possible to pause, stop, and resume iterators, readers, and writers.
- Remote
- A remote that allows for pausing, stopping, and resuming the
Halt
wrapper from another thread.
Functions§
- new
- Returns a new
Halt
wrapper aroundT
.