Struct playdate_system::System

source ·
pub struct System<Api = Default>(/* private fields */);

Implementations§

source§

impl<Api: Api> System<Api>

source

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) -> bool,

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.

Wrapping sys::ffi::playdate_sys::setUpdateCallback

source

pub fn set_update_callback_boxed<'u, U, F>(&self, on_update: F, userdata: U)where U: 'u, F: 'u + FnMut(&mut U) -> bool,

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.

Wrapping sys::ffi::playdate_sys::setUpdateCallback

source

pub fn set_update_callback_static<U: 'static>( &self, on_update: Option<fn(userdata: &mut U) -> bool>, 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.

Wrapping sys::ffi::playdate_sys::setUpdateCallback

source

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.

Wrapping sys::ffi::playdate_sys::setUpdateCallback

source§

impl System<Default>

source

pub fn Default() -> Self

Creates default System without type parameter requirement.

Uses ZST api::Default.

source§

impl<Api: Default + Api> System<Api>

source

pub fn new() -> Self

source§

impl<Api: Api> System<Api>

source

pub fn new_with(api: Api) -> Self

source§

impl<Api: Api> System<Api>

source

pub fn language(&self) -> PDLanguage

source

pub fn current_time_milliseconds(&self) -> Duration

source

pub fn seconds_since_epoch(&self) -> Duration

source

pub fn draw_fps(&self, x: c_int, y: c_int)

source

pub fn flipped(&self) -> bool

source

pub fn set_auto_lock_disabled(&self, disable: bool)

source

pub fn reduce_flashing(&self) -> bool

source

pub fn elapsed_time(&self) -> Duration

source

pub fn reset_elapsed_time(&self)

source

pub fn battery_percentage(&self) -> c_float

source

pub fn battery_voltage(&self) -> c_float

source

pub fn timezone_offset(&self) -> i32

source

pub fn should_display_24_hour_time(&self) -> bool

source

pub fn convert_epoch_to_date_time(&self, epoch: u32) -> PDDateTime

source

pub fn convert_epoch_to_date_time_to(&self, epoch: u32, dt: &mut PDDateTime)

source

pub fn convert_date_time_to_epoch(&self, dt: &PDDateTime) -> u32

Trait Implementations§

source§

impl<Api: Clone> Clone for System<Api>

source§

fn clone(&self) -> System<Api>

Returns a copy of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<Api: Debug> Debug for System<Api>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<Api: Default + Api> Default for System<Api>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<Api: Copy> Copy for System<Api>

Auto Trait Implementations§

§

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,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for Twhere T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for Twhere U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.

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.