1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
pub mod allocator;
pub mod panic;
pub mod proc;
pub mod macros;
pub mod error;


/// Main unsafe API endpoint.
pub static mut API: *const crate::ffi::PlaydateAPI = core::ptr::null_mut();

/// Reference to main (root) API endpoint.
pub type ApiRef = Option<&'static crate::ffi::PlaydateAPI>;

/// Returns reference to main API endpoint ([`ApiRef`]).
// TODO: make this `const fn` when rustc feature `const_ptr_as_ref` is well-tested.
#[inline(always)]
pub fn api() -> ApiRef { unsafe { API.as_ref() } }