2 releases

0.1.1 Apr 11, 2016
0.1.0 Mar 26, 2016

#55 in #console

MIT license

8KB
149 lines

screenprints

Build Status Software License crates.io

reprints for your terminal screen

Screenprints acts as a buffer for terminal display continuously printing output at a configured interval.

api docs

Find them here

usage

Screensprints defines a Printer which implements std::io::Write which means anywhere you would normally write output to, you could substitude in an instance of a Printer.

extern crate screenprints;

use screenprints::Printer;
use std::io::{stdout, Write};
use std::time::Duration;
use std::thread;

fn main() {
    let mut printer = Printer::new(stdout(), Duration::from_millis(10));
    for f in &["foo.txt", "bar.txt", "baz.txt"] {
        for i in 0..51 {
            let _ = write!(printer, "Downloading {}.. ({}/{}) GB\n", f, i, 50);
            thread::sleep(Duration::from_millis(50));
        }
    }
}

The result should look something like the following

asciicast

Doug Tangren (softprops) 2016

Dependencies

~18KB