Crate utmp_classic
source ·Expand description
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_classic::parse_from_path("tests/samples/basic.utmp")?;
// ...
If you don’t need to collect them all,
UtmpParser
can be used as an iterator:
use utmp_classic::UtmpParser;
for entry in UtmpParser::from_path("tests/samples/basic.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
.
Enums§
- Parsed utmp entry.
Functions§
- Parse utmp entries from the given file.
- Parse utmp entries from the given path.
- Parse utmp entries from the given reader.
Type Aliases§
- Parser to parse a 32-bit utmp file.
- Parser to parse a 64-bit utmp file.
- Parser to parse a utmp file. It can be used as an iterator.