#[app_impl]Expand description
This attribute macro can be applied to an impl block for a type to assign the associated
functions or methods named app_init, app_iterate, app_event and app_quit to the
respective sdl main callbacks, as if the corresponding attribute macros were used.
All four must be defined in a single impl block, but app_quit is optional and will be
defined as an empty function if omitted.
This is functionally the same as marking those functions with the respective attribute macros, but works with methods and uses the type the block is implemented for as the app state type.
See the documentation for app_init, app_iterate, app_event and app_quit
for information about supported function signatures. app_impl also supports methods,
taking self as the app state.
Example:
use sdl3_main::{app_impl, AppResult};
use sdl3_sys::events::SDL_Event;
use std::sync::Mutex;
struct MyAppState {
// ...
}
#[app_impl]
impl MyAppState {
fn app_init() -> Option<Box<Mutex<MyAppState>>> {
todo!()
}
fn app_iterate(&mut self) -> AppResult {
todo!()
}
fn app_event(&mut self, event: &SDL_Event) -> AppResult {
todo!()
}
}