[][src]Crate halt

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

Examples

Add this to Cargo.toml:

[dependencies]
halt = "0.5"

And this to main.rs:

use std::{io, thread};

fn main() {
    let mut halt = halt::new(io::repeat(0));
    let remote = halt.remote();
    // Copy into a sink, in a separate thread.
    thread::spawn(move || io::copy(&mut halt, &mut io::sink()).unwrap());
    // The remote can now be used to pause, stop, and resume the reader from the main thread.
    remote.pause();
    remote.resume();
}

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 wrapper around T.