acts/event/
action.rs

1use crate::event::EventAction;
2use crate::{utils, Vars};
3use serde::{Deserialize, Serialize};
4
5#[derive(Clone, Debug, Serialize, Deserialize)]
6pub struct Action {
7    pub pid: String,
8    pub tid: String,
9    pub event: EventAction,
10    pub options: Vars,
11}
12
13impl Action {
14    pub fn new(pid: &str, tid: &str, event: EventAction, options: &Vars) -> Self {
15        Self {
16            pid: pid.to_string(),
17            tid: tid.to_string(),
18            event,
19            options: options.clone(),
20        }
21    }
22
23    pub fn id(&self) -> String {
24        utils::Id::new(&self.pid, &self.tid).id()
25    }
26}