Crate staart[][src]

staart is a Rust implementation of a tail-like program for Linux systems

The library exposes public methods to allow other programs to follow a file internally. These methods are exposed on a struct TailedFile.

Example

use staart::TailedFile;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let args: Vec<String> = std::env::args().collect();
    let path = &args[1].as_str();
    let mut f = TailedFile::new(path)?;
    loop {
       f.follow()?;
       f.sleep();
    }
}

Structs

TailedFile

TailedFile tracks the state of a file being followed. It offers methods for updating this state, and printing data to stdout. The user may define the duration between updates if operating in a loop with delay.