#[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 {},
}

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()

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

InitWindow

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.

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

TerminateWindow

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.

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

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.

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

RedrawNeeded

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.

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

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.

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

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.

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

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>

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

SaveState

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>

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.

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

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.

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

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

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