1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#[derive(Debug, Display, Copy, Clone, Eq, PartialEq)]
pub enum EventType {
    Exec,
    ExecDone,
    Read,
    Miss,
}

#[derive(Debug)]
pub enum EventData<'a> {
    Exec(&'a str),
    ExecDone(i32),
    Read,
    Miss,
}

impl EventData<'_> {
    pub fn get_type(&self) -> EventType {
        match self {
            EventData::Exec(_) => EventType::Exec,
            EventData::ExecDone(_) => EventType::ExecDone,
            EventData::Read => EventType::Read,
            EventData::Miss => EventType::Miss,
        }
    }
}

#[derive(Debug)]
pub struct Event<'a> {
    pub data: EventData<'a>,
    pub script_id: i64,
}