1use endpoint_sec_sys::{es_auth_result_t, es_event_id_t, es_result_t, es_result_type_t};
4
5#[doc(alias = "es_event_id_t")]
7#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
8pub enum Action {
9 Auth(es_event_id_t),
11 Notify(ActionResult),
13}
14
15#[cfg(feature = "static_assertions")]
16static_assertions::assert_impl_all!(Action: Send);
17
18#[doc(alias = "es_result_t")]
22#[doc(alias = "es_result_type_t")]
23#[doc(alias = "es_auth_result_t")]
24#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
25pub enum ActionResult {
26 Auth(es_auth_result_t),
28 Flags(u32),
30}
31
32impl ActionResult {
33 pub(crate) fn from_raw(r: es_result_t) -> Option<Self> {
35 match r.result_type {
36 es_result_type_t::ES_RESULT_TYPE_AUTH => Some(Self::Auth(unsafe { r.result.auth })),
38 es_result_type_t::ES_RESULT_TYPE_FLAGS => Some(Self::Flags(unsafe { r.result.flags })),
40 _ => None,
41 }
42 }
43}
44
45#[cfg(feature = "static_assertions")]
46static_assertions::assert_impl_all!(ActionResult: Send);