tracing_tape/record/
mod.rs

1mod callsite;
2pub use callsite::{field_type, CallsiteFieldRecord, CallsiteRecord};
3
4mod event;
5pub use event::{EventRecord, EventValueRecord};
6
7mod span;
8pub use span::{
9    parent_kind, SpanCloseRecord, SpanEnterRecord, SpanExitRecord, SpanFollowsRecord,
10    SpanOpenRecord, SpanOpenRecord2, SpanValueRecord,
11};
12use zerocopy::{little_endian, AsBytes, FromBytes, FromZeroes, Unaligned};
13
14pub mod record_kind {
15    pub const NOOP: u8 = 0;
16    pub const THREAD_NAME: u8 = 0x01;
17    pub const CALLSITE: u8 = 0x08;
18    pub const CALLSITE_FIELD: u8 = 0x09;
19
20    pub const EVENT: u8 = 0x10;
21    pub const EVENT_VALUE: u8 = 0x11;
22
23    pub const SPAN_OPEN: u8 = 0x20;
24    pub const SPAN_ENTER: u8 = 0x21;
25    pub const SPAN_EXIT: u8 = 0x22;
26    pub const SPAN_CLOSE: u8 = 0x23;
27    pub const SPAN_VALUE: u8 = 0x24;
28    pub const SPAN_FOLLOWS: u8 = 0x25;
29}
30
31#[derive(Debug, Clone, Copy, AsBytes, FromBytes, FromZeroes, Unaligned)]
32#[repr(C)]
33pub struct RecordHeader {
34    pub kind: u8,
35    pub len: little_endian::U16,
36}
37
38impl RecordHeader {
39    pub fn new(kind: u8, len: u16) -> Self {
40        RecordHeader {
41            kind,
42            len: len.into(),
43        }
44    }
45}