Skip to main content

emf_core_base_rs/fn_caster/
sys.rs

1//! Casters for the sys api.
2use crate::ffi::sys::api;
3use crate::ffi::{CBaseFn, FnId};
4use crate::fn_caster::FnCaster;
5
6/// Caster for [FnId::SysShutdown]
7#[derive(Debug)]
8pub struct ShutdownCaster {}
9
10/// Caster for [FnId::SysPanic]
11#[derive(Debug)]
12pub struct PanicCaster {}
13
14/// Caster for [FnId::SysHasFunction]
15#[derive(Debug)]
16pub struct HasFunctionCaster {}
17
18/// Caster for [FnId::SysGetFunction]
19#[derive(Debug)]
20pub struct GetFunctionCaster {}
21
22/// Caster for [FnId::SysLock]
23#[derive(Debug)]
24pub struct LockCaster {}
25
26/// Caster for [FnId::SysTryLock]
27#[derive(Debug)]
28pub struct TryLockCaster {}
29
30/// Caster for [FnId::SysUnlock]
31#[derive(Debug)]
32pub struct UnlockCaster {}
33
34/// Caster for [FnId::SysGetSyncHandler]
35#[derive(Debug)]
36pub struct GetSyncHandlerCaster {}
37
38/// Caster for [FnId::SysSetSyncHandler]
39#[derive(Debug)]
40pub struct SetSyncHandlerCaster {}
41
42transmute_caster!(ShutdownCaster, api::ShutdownFn, FnId::SysShutdown);
43
44transmute_caster!(PanicCaster, api::PanicFn, FnId::SysPanic);
45
46transmute_caster!(HasFunctionCaster, api::HasFunctionFn, FnId::SysHasFunction);
47
48transmute_caster!(GetFunctionCaster, api::GetFunctionFn, FnId::SysGetFunction);
49
50transmute_caster!(LockCaster, api::LockFn, FnId::SysLock);
51
52transmute_caster!(TryLockCaster, api::TryLockFn, FnId::SysTryLock);
53
54transmute_caster!(UnlockCaster, api::UnlockFn, FnId::SysUnlock);
55
56transmute_caster!(
57    GetSyncHandlerCaster,
58    api::GetSyncHandlerFn,
59    FnId::SysGetSyncHandler
60);
61
62transmute_caster!(
63    SetSyncHandlerCaster,
64    api::SetSyncHandlerFn,
65    FnId::SysSetSyncHandler
66);