#resume #pause #stop

halt

提供暂停、停止和恢复迭代器、读取器和写入器的功能

10 个版本 (4 个稳定版)

2.0.2 2022 年 6 月 22 日
2.0.1 2020 年 5 月 15 日
2.0.0 2020 年 1 月 24 日
1.0.0 2019 年 12 月 18 日
0.5.0 2019 年 11 月 28 日

#359 in 并发

MIT/Apache

10KB
180

halt

Rust Crates.io Docs

提供暂停、停止和恢复迭代器、读取器和写入器的功能。

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

许可协议

许可协议为以下两种之一:

任选其一。

贡献

除非你明确声明,否则根据 Apache-2.0 许可证定义的,你有意提交的任何贡献,包括在本作品中包含的贡献,都应按照上述方式双重许可,不附加任何额外条款或条件。

无运行时依赖