Enum android_activity::MainEvent

source ·
#[non_exhaustive]
pub enum MainEvent<'a> {
Show 17 variants InputAvailable, InitWindow {}, TerminateWindow {}, WindowResized {}, RedrawNeeded {}, ContentRectChanged {}, GainedFocus, LostFocus, ConfigChanged {}, LowMemory, Start, Resume { loader: StateLoader<'a>, }, SaveState { saver: StateSaver<'a>, }, Pause, Stop, Destroy, InsetsChanged {},
}
Expand description

An application event delivered during AndroidApp::poll_events

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

InputAvailable

New input events are available via AndroidApp::input_events_iter()

Note: Even if more input is received this event will not be resent until AndroidApp::input_events_iter() has been called, which enables applications to batch up input processing without there being lots of redundant event loop wake ups.

§

InitWindow

Command from main thread: a new NativeWindow is ready for use. Upon receiving this command, AndroidApp::native_window() will return the new window

§

TerminateWindow

Command from main thread: the existing NativeWindow needs to be terminated. Upon receiving this command, AndroidApp::native_window() still returns the existing window; after returning from the AndroidApp::poll_events() callback then AndroidApp::native_window() will return None.

§

WindowResized

Command from main thread: the current NativeWindow has been resized. Please redraw with its new size.

§

RedrawNeeded

Command from main thread: the current NativeWindow needs to be redrawn. You should redraw the window before the AndroidApp::poll_events() callback returns in order to avoid transient drawing glitches.

§

ContentRectChanged

Command from main thread: the content area of the window has changed, such as from the soft input window being shown or hidden. You can get the new content rect by calling AndroidApp::content_rect()

§

GainedFocus

Command from main thread: the app’s activity window has gained input focus.

§

LostFocus

Command from main thread: the app’s activity window has lost input focus.

§

ConfigChanged

Command from main thread: the current device configuration has changed. You can get a copy of the latest ndk::configuration::Configuration by calling AndroidApp::config()

§

LowMemory

Command from main thread: the system is running low on memory. Try to reduce your memory use.

§

Start

Command from main thread: the app’s activity has been started.

§

Resume

Command from main thread: the app’s activity has been resumed.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§loader: StateLoader<'a>
§

SaveState

Command from main thread: the app should generate a new saved state for itself, to restore from later if needed. If you have saved state, allocate it with malloc and place it in android_app.savedState with the size in android_app.savedStateSize. The will be freed for you later.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§saver: StateSaver<'a>
§

Pause

Command from main thread: the app’s activity has been paused.

§

Stop

Command from main thread: the app’s activity has been stopped.

§

Destroy

Command from main thread: the app’s activity is being destroyed, and waiting for the app thread to clean up and exit before proceeding.

§

InsetsChanged

Command from main thread: the app’s insets have changed.

Trait Implementations§

source§

impl<'a> Debug for MainEvent<'a>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for MainEvent<'a>

§

impl<'a> RefUnwindSafe for MainEvent<'a>

§

impl<'a> Send for MainEvent<'a>

§

impl<'a> Sync for MainEvent<'a>

§

impl<'a> Unpin for MainEvent<'a>

§

impl<'a> UnwindSafe for MainEvent<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

fn into(self) -> U

Calls U::from(self).

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

source§

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

§

type Error = Infallible

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

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

Performs the conversion.
source§

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

§

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

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

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

Performs the conversion.