Expand description
Contains the parser for memtrace’s CTF dump format.
The parser is designed in such a way that there are no runtime checks related to big-/low-endian
encoding. The main building block is RawParser
, which features parsing primitives for a wide
range of types. In particular, integers and floats have a big-endian version and a low-endian
one.
The actual parser type is Parser
, which takes a type parameter Endian
corresponding to the
endian specification. It can be either LowEndian
or BigEndian
. Both these types are not
meant to be constructed in practice, they are just type-level information encoding the endian
specification to use. So, in practice, Parser<LowEndian>
directly parses all integers/floats
as assuming a low-endian convention, and similarily for Parser<BigEndian>
.
Deciding which endian convention to use happens when parsing the memtrace CTF magic number. This
is done by creating a RawParser
, and calling the try_magic
method. Note that when
parsing a CTF file, the magic number is the first thing parsed.
This gives either a Parser<LowEndian>
or a Parser<BigEndian
(or an error). Once parsing
starts with either of these types, a change in endian convention is considered an error.
Structs
Type representing big-endian parsing.
Top-level parser.
Parsing context.
Type representing low-endian parsing.
Packet parser.
A parser, parameterized by an endian specification (big or low).
A position in the parser (zero-cost wrapper around a usize).
Raw parser.
Traits
Trait implemented by the big-endian parser and the low-endian parser.
Type Definitions
Big-endian CTF parser.
Big-endian packet parser.
Big-endian parser.
Low-endian CTF parser.
Low-endian packet parser.
Low-endian parser.