1 unstable release
0.1.0 | Jun 18, 2024 |
---|
#1689 in Parser implementations
40 downloads per month
40KB
920 lines
journald-export-parser-rs
Rust Journald Export Format Parser
lib.rs
:
Journald Journal Export Format Parser.
This library contains a small parser for the Journald Journal Export Format.
The format is very versatile. Each stream consists of a series of journal entries, each of which comprising one or more fields. A field is simply a key value pair, similar to Unix process environment variables.
The parser avoids heap allocations and operates on a buffer with bounded size. The lengths of the fields and overall entry size can be controlled using with the config::JournalExportLimits struct.
The parsing logic is separated out from any i/o-logic. self::journald::parser::JournalExportParser contains the parser logic and manages the buffer. The structs [JournalExportAsyncRead] and [JournalExportRead] provide async and sync versions of a parser.
Implementation notes
Both, [JournalExportRead] and [JournalExportAsyncRead] are stateful objects
that buffer the last parsed journal entry. The latter can be accessed using
the get_entry()
-method which returns a journald::parser::RefEntry object.
Dependencies
~1.2–2MB
~39K SLoC