Skip to content

softprops/screenprints

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

reprints for your terminal screen

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published