Crates.io | utwt |
lib.rs | utwt |
version | 0.4.1 |
source | src |
created_at | 2023-09-07 03:43:30.666494 |
updated_at | 2024-08-02 14:19:44.817305 |
description | Parsing utmp file |
homepage | |
repository | https://github.com/cijiugechu/utwt |
max_upload_size | |
id | 965855 |
size | 28,326 |
utwt
A Rust crate for parsing utmp
files like /var/run/utmp
and /var/log/wtmp
.
Note: This project has been forked from utmp-rs since September of 2023, but a lot has changed.
Simplest way is to use parse_from_*
functions,
which returns a Vec<UtmpEntry>
on success:
let entries = utwt::parse_utmp()?;
// or specify a path explicitly
let entries = utwt::parse_from_path("/var/run/utmp")?;
//
If you don't need to collect them all,
UtmpParser
can be used as an iterator:
use utwt::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
.