endpoint_sec/event/event_trace.rs
1//! [`EventTrace`]
2
3use endpoint_sec_sys::es_event_trace_t;
4
5use crate::Process;
6
7/// Fired when one process attempts to attach to another process event.
8#[doc(alias = "es_event_trace_t")]
9pub struct EventTrace<'a> {
10 /// The raw reference.
11 pub(crate) raw: &'a es_event_trace_t,
12
13 /// The version of the message.
14 pub(crate) version: u32,
15}
16
17impl<'a> EventTrace<'a> {
18 /// The process that will be attached to by the process that instigated the event.
19 #[inline(always)]
20 pub fn target(&self) -> Process<'a> {
21 // Safety: 'a tied to self, object obtained through ES
22 Process::new(unsafe { self.raw.target() }, self.version)
23 }
24}
25
26// Safety: safe to send across threads: does not contain any interior mutability nor depend on current thread state
27unsafe impl Send for EventTrace<'_> {}
28// Safety: safe to share across threads: does not contain any interior mutability nor depend on current thread state
29unsafe impl Sync for EventTrace<'_> {}
30
31impl_debug_eq_hash_with_functions!(EventTrace<'a> with version; target);