Skip to main content

endpoint_sec/event/
event_setattrlist.rs

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