[][src]Function jsonxf::pretty_print_stream

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

Pretty-prints a stream of JSON-encoded data.

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

The output will use two spaces as an indent, a line feed as newline character, and no trailing whitespace. To customize this behavior, use a jsonxf::Formatter::pretty_printer() directly.

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

Example:

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