pub mod engine;
pub mod northstar;
pub mod squirrel;
pub mod squirrel_traits;
pub mod vector;
#[cfg(feature = "async_engine")]
pub mod engine_sync;
#[doc(hidden)]
#[cfg(not(feature = "async_engine"))]
#[doc = "enable engine sync feature if you want to use it"]
pub mod engine_sync {
#[doc(hidden)]
#[inline(always)]
pub const fn init_async_routine() {}
#[doc(hidden)]
#[inline(always)]
pub const unsafe fn run_async_routine() {}
}
#[repr(transparent)]
pub struct UnsafeHandle<T> {
inner: T,
}
impl<T> UnsafeHandle<T> {
#[inline]
pub(crate) const fn internal_new(value: T) -> Self {
Self { inner: value }
}
#[inline]
pub const unsafe fn new(value: T) -> Self {
Self { inner: value }
}
#[inline]
pub const fn get(&self) -> &T {
&self.inner
}
#[inline]
pub fn get_mut(&mut self) -> &mut T {
&mut self.inner
}
#[inline]
pub fn take(self) -> T {
self.inner
}
}
impl<T: Clone + Copy> UnsafeHandle<T> {
#[inline]
pub const fn copy(&self) -> T {
self.inner
}
}
impl<T: std::fmt::Debug> std::fmt::Debug for UnsafeHandle<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(&format!("{:?}", self.inner))
}
}
impl<T: std::fmt::Display> std::fmt::Display for UnsafeHandle<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(&format!("{}", self.inner))
}
}
unsafe impl<T> Sync for UnsafeHandle<T> {}
unsafe impl<T> Send for UnsafeHandle<T> {}