pub trait CanParse<'data>: Sized + Deref<Target = RawParser<'data>> + DerefMut {
type Endian;
Show 18 methods
fn is_big_endian(&self) -> bool;
fn u8(&mut self) -> Res<u8>;
fn u16(&mut self) -> Res<u16>;
fn u32(&mut self) -> Res<u32>;
fn u64(&mut self) -> Res<u64>;
fn f64(&mut self) -> Res<f64>;
fn clock(&mut self) -> Res<u64> { ... }
fn v_usize(&mut self) -> Res<usize> { ... }
fn alloc(
&mut self,
timestamp: u64,
cxt: &mut Cxt<'data>,
short: Option<usize>
) -> Res<Alloc> { ... }
fn alloc_uid_from_delta(&mut self, cxt: &Cxt<'data>) -> Res<u64> { ... }
fn locs(&mut self, cxt: &mut Cxt<'data>) -> Res<Locs<'data>> { ... }
fn cache_check(&mut self) -> Res<CacheCheck> { ... }
fn event_kind(&mut self, header: &Header) -> Res<(Kind, DeltaClock)> { ... }
fn packet_header(&mut self, id: usize) -> Res<Packet> { ... }
fn ctf_header(&mut self) -> Res<Ctf> { ... }
fn raw_package_header(
&mut self,
parse_magic: bool
) -> Res<(Header, CacheCheck)> { ... }
fn trace_info(&mut self, header: &Ctf) -> Res<Info<'data>> { ... }
fn magic(&mut self) -> Res<()> { ... }
}
Expand description
Trait implemented by the big-endian parser and the low-endian parser.
Required Associated Types
Required Methods
fn is_big_endian(&self) -> bool
fn is_big_endian(&self) -> bool
True if the parser is big-endian.
Provided Methods
Parses an allocation.
Context-sensitive.
fn alloc_uid_from_delta(&mut self, cxt: &Cxt<'data>) -> Res<u64>
fn alloc_uid_from_delta(&mut self, cxt: &Cxt<'data>) -> Res<u64>
Parses an allocation UID from a delta w.r.t. the most recent UID generated.
Context-sensitive.
Used when retrieving the UID of a promotion/collection.
Panics
Calling this function before any allocation UID is generated is a logical error. As long as this function is used only for promotion/collection, it will not panic on coherent CTF files. This is because promoting/collecting necessarily talks about an allocation that was created previously, meaning at least one allocation UID was generated.
In debug, the code actually
debug_assert
s this. In release, the panic will be an arithmetic underflow.
Parses some new locations.
Context-sensitive.
fn cache_check(&mut self) -> Res<CacheCheck>
fn cache_check(&mut self) -> Res<CacheCheck>
Parses cache-checking information.
fn event_kind(&mut self, header: &Header) -> Res<(Kind, DeltaClock)>
fn event_kind(&mut self, header: &Header) -> Res<(Kind, DeltaClock)>
Parses an event header.
fn packet_header(&mut self, id: usize) -> Res<Packet>
fn packet_header(&mut self, id: usize) -> Res<Packet>
Parses a packet header.
A packet is a sequence of events.
fn ctf_header(&mut self) -> Res<Ctf>
fn ctf_header(&mut self) -> Res<Ctf>
Parses the top-level CTF header.
The CTF header is the first element of a CTF file, followed by the trace info, and then the sequence of packets.
fn raw_package_header(&mut self, parse_magic: bool) -> Res<(Header, CacheCheck)>
fn raw_package_header(&mut self, parse_magic: bool) -> Res<(Header, CacheCheck)>
Raw package header parser.
Returns internal errors as they are, should only be called by ctf_header
and
packet_header
which enrich these errors.
fn trace_info(&mut self, header: &Ctf) -> Res<Info<'data>>
fn trace_info(&mut self, header: &Ctf) -> Res<Info<'data>>
Parses a trace info.
Technically, a trace info is a normal event, meaning it could appear in a normal packet. However, currently the trace info needs to be unique and appear between the CTF (top-level) header and the first package of the trace.