endpoint_sec/event/event_setflags.rs
1//! [`EventSetFlags`]
2
3use endpoint_sec_sys::es_event_setflags_t;
4
5use crate::File;
6
7/// Modify file flags information event.
8#[doc(alias = "es_event_setflags_t")]
9pub struct EventSetFlags<'a> {
10 /// Raw event
11 pub(crate) raw: &'a es_event_setflags_t,
12}
13
14impl<'a> EventSetFlags<'a> {
15 /// The desired new flags.
16 #[inline(always)]
17 pub fn flags(&self) -> u32 {
18 self.raw.flags
19 }
20
21 /// The file for which flags information 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 EventSetFlags<'_> {}
31// Safety: safe to share across threads: does not contain any interior mutability nor depend on current thread state
32unsafe impl Sync for EventSetFlags<'_> {}
33
34impl_debug_eq_hash_with_functions!(EventSetFlags<'a>; flags, target);