endpoint_sec/event/
event_deleteextattr.rs

1//! [`EventDeleteExtAttr`]
2
3use std::ffi::OsStr;
4
5use endpoint_sec_sys::es_event_deleteextattr_t;
6
7use crate::File;
8
9/// Delete an extended attribute event.
10#[doc(alias = "es_event_deleteextattr_t")]
11pub struct EventDeleteExtAttr<'a> {
12    /// Raw event
13    pub(crate) raw: &'a es_event_deleteextattr_t,
14}
15
16impl<'a> EventDeleteExtAttr<'a> {
17    /// The extended attribute which will be deleted.
18    #[inline(always)]
19    pub fn extattr(&self) -> &'a OsStr {
20        // Safety: 'a tied to self, object obtained through ES
21        unsafe { self.raw.extattr.as_os_str() }
22    }
23
24    #[inline(always)]
25    /// The file for which the extended attribute will be deleted
26    pub fn target(&self) -> File<'a> {
27        // Safety: 'a tied to self, object obtained through ES
28        File::new(unsafe { self.raw.target() })
29    }
30}
31
32// Safety: safe to send across threads: does not contain any interior mutability nor depend on current thread state
33unsafe impl Send for EventDeleteExtAttr<'_> {}
34// Safety: safe to share across threads: does not contain any interior mutability nor depend on current thread state
35unsafe impl Sync for EventDeleteExtAttr<'_> {}
36
37impl_debug_eq_hash_with_functions!(EventDeleteExtAttr<'a>; extattr, target);