Skip to main content

endpoint_sec/event/
event_profile_remove.rs

1//! [`EventProfileRemove`]
2
3use endpoint_sec_sys::es_event_profile_remove_t;
4
5use crate::{Process, Profile};
6
7/// Notification for Profiles removed on the system.
8#[doc(alias = "es_event_profile_remove_t")]
9pub struct EventProfileRemove<'a> {
10    /// The raw reference.
11    pub(crate) raw: &'a es_event_profile_remove_t,
12    /// The version of the message.
13    pub(crate) version: u32,
14}
15
16impl<'a> EventProfileRemove<'a> {
17    /// Process that instigated the Profile removal.
18    #[inline(always)]
19    pub fn instigator(&self) -> Process<'a> {
20        // Safety: 'a tied to self, object obtained through ES
21        Process::new(unsafe { self.raw.instigator.as_ref() }, self.version)
22    }
23
24    /// Profile install item.
25    #[inline(always)]
26    pub fn profile(&self) -> Profile<'a> {
27        Profile {
28            // Safety: 'a tied to self, object obtained through ES
29            raw: unsafe { self.raw.profile.as_ref() },
30        }
31    }
32}
33
34// Safety: safe to send across threads: does not contain any interior mutability nor depend on current thread state
35unsafe impl Send for EventProfileRemove<'_> {}
36// Safety: safe to share across threads: does not contain any interior mutability nor depend on current thread state
37unsafe impl Sync for EventProfileRemove<'_> {}
38
39impl_debug_eq_hash_with_functions!(EventProfileRemove<'a> with version; instigator, profile);