[][src]Function jsonxf::minimize_stream

pub fn minimize_stream(
    input: &mut dyn Read,
    output: &mut dyn Write
) -> Result<(), Error>

Minimizes a stream of JSON-encoded data.

Input must be valid JSON data in UTF-8 encoding.

The output will use a line feed as newline character between records, and no trailing whitespace. To customize this behavior, use a jsonxf::Formatter::minimizer() directly.

minimize_stream uses std::io::BufReader and std::io:BufWriter to provide IO buffering; no external buffering should be necessary.

Example:

match jsonxf::minimize_stream(&mut std::io::stdin(), &mut std::io::stdout()) {
    Ok(_) => { /* YAY */ },
    Err(e) => { panic!(e.to_string()) }
};