utmp-rs

Crates.ioutmp-rs
lib.rsutmp-rs
version0.4.0
sourcesrc
created_at2020-02-09 03:11:03.5571
updated_at2024-09-27 13:07:20.293669
descriptionParsing utmp file
homepage
repositoryhttps://github.com/upsuper/utmp-rs
max_upload_size
id206540
size52,299
Xidorn Quan (upsuper)

documentation

README

utmp-rs

Crates.io Docs

A Rust crate for parsing utmp files like /var/run/utmp and /var/log/wtmp.

Usage

Simplest way is to use parse_from_* functions, which returns a Vec<UtmpEntry> on success:

let entries = utmp_rs::parse_from_path("/var/run/utmp")?;
// ...

If you don't need to collect them all, UtmpParser can be used as an iterator:

use utmp_rs::UtmpParser;
for entry in UtmpParser::from_path("/var/run/utmp")? {
    let entry = entry?;
    // ...
}

All the parse_from_* functions as well as UtmpParser parse utmp file based on the native format for the target platform. If cross-platform parsing is needed, Utmp32Parser or Utmp64Parser can be used instead of UtmpParser.

Commit count: 24

cargo fmt