use crate::fn_caster::FnCaster;
use crate::global::{get_interface, get_mut_interface, LockToken};
use crate::sys::sync_handler::SyncHandlerAPI;
use crate::sys::{SysAPI, SysAPIMin};
use std::ffi::CStr;
#[inline]
pub fn panic(error: Option<impl AsRef<CStr>>) -> ! {
SysAPIMin::panic(get_interface(), error)
}
#[inline]
pub fn shutdown<L>(_token: &mut LockToken<L>) -> ! {
SysAPI::shutdown(get_mut_interface())
}
#[inline]
pub fn has_function<U>() -> bool
where
U: FnCaster,
{
SysAPIMin::has_function::<U>(get_interface())
}
#[inline]
pub fn get_function<U>(caster: &U) -> Option<<U as FnCaster>::Type>
where
U: FnCaster,
{
SysAPIMin::get_function::<U>(get_interface(), caster)
}
#[inline]
pub fn get_sync_handler<L, U>(_token: &LockToken<L>) -> <U as SyncHandlerAPI<'static>>::Handler
where
U: SyncHandlerAPI<'static>,
{
SysAPI::get_sync_handler::<U>(get_interface())
}
#[inline]
pub unsafe fn set_sync_handler<L>(
_token: &mut LockToken<L>,
handler: Option<&impl SyncHandlerAPI<'static>>,
) {
SysAPI::set_sync_handler(get_mut_interface(), handler)
}