pub struct System<Api = Default>(/* private fields */);Implementations§
Source§impl<Api: Api> System<Api>
impl<Api: Api> System<Api>
Sourcepub fn set_update_callback<'u, U, F>(
&self,
on_update: F,
userdata: U,
) -> Handler<'u, F, U>where
U: 'u,
F: 'u + FnMut(&mut U) -> UpdateCtrl,
pub fn set_update_callback<'u, U, F>(
&self,
on_update: F,
userdata: U,
) -> Handler<'u, F, U>where
U: 'u,
F: 'u + FnMut(&mut U) -> UpdateCtrl,
Takes any function and userdata,
registers callback in the system and
returns this function with userdata wrapped into the Handler with [Pin] inside.
For register a fn-ptr you could better use [set_update_callback_static].
Safety is ensured by Handler,
that resets the system registered update handler when drop.
Sourcepub fn set_update_callback_boxed<'u, U, F>(&self, on_update: F, userdata: U)where
U: 'u,
F: 'u + FnMut(&mut U) -> UpdateCtrl,
pub fn set_update_callback_boxed<'u, U, F>(&self, on_update: F, userdata: U)where
U: 'u,
F: 'u + FnMut(&mut U) -> UpdateCtrl,
Consumes and leaks an any function with userdata into the Box,
registers callback in the system.
For register a fn-ptr you could better use [set_update_callback_static].
Safety is guaranteed by the caller.
See also System::set_update_callback, it prevents leaks and more safe.
Sourcepub fn set_update_callback_static<U: 'static>(
&self,
on_update: Option<fn(userdata: &mut U) -> UpdateCtrl>,
userdata: U,
)
pub fn set_update_callback_static<U: 'static>( &self, on_update: Option<fn(userdata: &mut U) -> UpdateCtrl>, userdata: U, )
Consumes and leaks function on_update and userdata, wraps it into the Box,
then registers callback.
See also System::set_update_callback, it prevents leaks and more safe.
Sourcepub fn set_update_handler<'t, U: 'static + Update>(
&'t self,
handler: Option<&'static mut U>,
)where
&'t Api: Api,
pub fn set_update_handler<'t, U: 'static + Update>(
&'t self,
handler: Option<&'static mut U>,
)where
&'t Api: Api,
Executes handler’s Update::set_update_handler_with with this inner api.
Source§impl System<Default>
impl System<Default>
Sourcepub fn Default() -> Self
pub fn Default() -> Self
Creates default System without type parameter requirement.
Uses ZST api::Default.
Source§impl System<Cache>
impl System<Cache>
Sourcepub fn Cached() -> Self
pub fn Cached() -> Self
Creates System without type parameter requirement.
Uses api::Cache.
Source§impl<Api: Api> System<Api>
impl<Api: Api> System<Api>
Sourcepub fn language(&self) -> PDLanguage
pub fn language(&self) -> PDLanguage
Equivalent to sys::ffi::playdate_sys::getLanguage
Sourcepub fn current_time(&self) -> Duration
pub fn current_time(&self) -> Duration
Equivalent to sys::ffi::playdate_sys::getCurrentTimeMilliseconds
Sourcepub fn current_time_ms(&self) -> c_uint
pub fn current_time_ms(&self) -> c_uint
Equivalent to sys::ffi::playdate_sys::getCurrentTimeMilliseconds
Sourcepub fn seconds_since_epoch(&self) -> c_uint
pub fn seconds_since_epoch(&self) -> c_uint
Returns the number of seconds elapsed since midnight (hour 0), January 1, 2000.
See also System::seconds_since_epoch_with_ms.
Equivalent to sys::ffi::playdate_sys::getSecondsSinceEpoch
Sourcepub fn seconds_since_epoch_with_ms(&self) -> (c_uint, c_uint)
pub fn seconds_since_epoch_with_ms(&self) -> (c_uint, c_uint)
Returns current time as (seconds, milliseconds),
elapsed since midnight (hour 0), January 1, 2000.
Equivalent to sys::ffi::playdate_sys::getSecondsSinceEpoch
Sourcepub fn time_since_epoch(&self) -> Duration
pub fn time_since_epoch(&self) -> Duration
Equivalent to sys::ffi::playdate_sys::getSecondsSinceEpoch
Sourcepub fn draw_fps(&self, x: c_int, y: c_int)
pub fn draw_fps(&self, x: c_int, y: c_int)
Equivalent to sys::ffi::playdate_sys::drawFPS
Sourcepub fn flipped(&self) -> bool
pub fn flipped(&self) -> bool
Equivalent to sys::ffi::playdate_sys::getFlipped
Sourcepub fn set_auto_lock_disabled(&self, disable: bool)
pub fn set_auto_lock_disabled(&self, disable: bool)
Equivalent to sys::ffi::playdate_sys::setAutoLockDisabled
Sourcepub fn reduce_flashing(&self) -> bool
pub fn reduce_flashing(&self) -> bool
Equivalent to sys::ffi::playdate_sys::getReduceFlashing
Sourcepub fn elapsed_time_secs(&self) -> c_float
pub fn elapsed_time_secs(&self) -> c_float
Returns the number of seconds since [reset_elapsed_time] was called.
The value is a floating-point number with microsecond accuracy.
Equivalent to sys::ffi::playdate_sys::getElapsedTime
Sourcepub fn elapsed_time(&self) -> Duration
pub fn elapsed_time(&self) -> Duration
Equivalent to sys::ffi::playdate_sys::getElapsedTime
Sourcepub fn reset_elapsed_time(&self)
pub fn reset_elapsed_time(&self)
Equivalent to sys::ffi::playdate_sys::resetElapsedTime
Sourcepub fn battery_percentage(&self) -> c_float
pub fn battery_percentage(&self) -> c_float
Equivalent to sys::ffi::playdate_sys::getBatteryPercentage
Sourcepub fn battery_voltage(&self) -> c_float
pub fn battery_voltage(&self) -> c_float
Equivalent to sys::ffi::playdate_sys::getBatteryVoltage
Sourcepub fn timezone_offset(&self) -> i32
pub fn timezone_offset(&self) -> i32
Equivalent to sys::ffi::playdate_sys::getTimezoneOffset
Sourcepub fn should_display_24_hour_time(&self) -> bool
pub fn should_display_24_hour_time(&self) -> bool
Equivalent to sys::ffi::playdate_sys::shouldDisplay24HourTime
Sourcepub fn convert_epoch_to_date_time(&self, epoch: u32) -> PDDateTime
pub fn convert_epoch_to_date_time(&self, epoch: u32) -> PDDateTime
Equivalent to sys::ffi::playdate_sys::convertEpochToDateTime
Sourcepub fn convert_epoch_to_date_time_to(&self, epoch: u32, dt: &mut PDDateTime)
pub fn convert_epoch_to_date_time_to(&self, epoch: u32, dt: &mut PDDateTime)
Equivalent to sys::ffi::playdate_sys::convertEpochToDateTime
Sourcepub fn convert_date_time_to_epoch(&self, dt: &PDDateTime) -> u32
pub fn convert_date_time_to_epoch(&self, dt: &PDDateTime) -> u32
Equivalent to sys::ffi::playdate_sys::convertDateTimeToEpoch
Sourcepub fn set_serial_message_callback<F>(&self, callback: Option<F>)where
F: 'static + FnMut(String) + Sized,
pub fn set_serial_message_callback<F>(&self, callback: Option<F>)where
F: 'static + FnMut(String) + Sized,
Equivalent to sys::ffi::playdate_sys::setSerialMessageCallback
Trait Implementations§
impl<Api: Copy> Copy for System<Api>
Auto Trait Implementations§
impl<Api> Freeze for System<Api>where
Api: Freeze,
impl<Api> RefUnwindSafe for System<Api>where
Api: RefUnwindSafe,
impl<Api> Send for System<Api>where
Api: Send,
impl<Api> Sync for System<Api>where
Api: Sync,
impl<Api> Unpin for System<Api>where
Api: Unpin,
impl<Api> UnwindSafe for System<Api>where
Api: UnwindSafe,
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)§impl<T, U> Into<U> for Twhere
U: From<T>,
impl<T, U> Into<U> for Twhere
U: From<T>,
§impl<T> ToOwned for Twhere
T: Clone,
impl<T> ToOwned for Twhere
T: Clone,
§impl<T, U> TryFrom<U> for Twhere
U: Into<T>,
impl<T, U> TryFrom<U> for Twhere
U: Into<T>,
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.