term-snip 0.1.9

Write limited number of lines to terminal
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use term_snip::TermSnip;

use std::{thread, time};

/// A simple example writing 15 lines to stdout but only showing
/// a maximum of five lines.
fn main() {
    let half_sec = time::Duration::from_millis(500);

    let mut term = TermSnip::new(5);
    for n in 1..15 {
        term.write_line(&format!("{} - line number {}", n, n))
            .unwrap();

        // just to slow down for demonstration
        thread::sleep(half_sec);
    }
}