GitHub license Crates.io

This implements the Read trait, calling a function to generate the data.

See the API documentation.

Import Crate

read_with="0.1"

Example

``` let mut output = vec!(); let many_strings = ["one", "two", "three"]; let mut pos = 0;

std::io::copy( &mut ReadWith::new( || { if pos == manystrings.len() { return None; } let o = manystrings[pos]; pos+=1; Some(o) } ), &mut output, ).unwrap(); asserteq!("onetwothree", str::fromutf8(&output).unwrap()); ```