pub trait Application:
UiBuilder
+ Sized
+ 'static {
type UserEvent: Send + 'static;
type Data;
const EVENT_FLAGS: EventFlags = _;
// Required method
fn new(args: Args<'_, Self>) -> Self;
// Provided methods
fn window_event(
&mut self,
args: Args<'_, Self>,
_event: WindowEvent,
res: EventResult,
) { ... }
fn window_event_full(&mut self, args: Args<'_, Self>, event: WindowEvent) { ... }
fn device_event(
&mut self,
_args: Args<'_, Self>,
_device_id: DeviceId,
_event: DeviceEvent,
) { ... }
fn user_event(&mut self, _args: Args<'_, Self>, _event: Self::UserEvent) { ... }
fn suspended(&mut self, _args: Args<'_, Self>) { ... }
fn resumed(&mut self, _args: Args<'_, Self>) { ... }
}
Expand description
Trait that connects a UiBuilder
with an AppHandler
.
Implement this to manage the main loop of your application.
Provided Associated Constants§
Sourceconst EVENT_FLAGS: EventFlags = _
const EVENT_FLAGS: EventFlags = _
The EventFlags
for this application. Usually the default is ok.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn window_event(
&mut self,
args: Args<'_, Self>,
_event: WindowEvent,
res: EventResult,
)
fn window_event( &mut self, args: Args<'_, Self>, _event: WindowEvent, res: EventResult, )
A new window event has been received.
When this is called the event has already been fed to the ImGui
context. The output is in res
.
The default impl will end the application when the window is closed.
Sourcefn window_event_full(&mut self, args: Args<'_, Self>, event: WindowEvent)
fn window_event_full(&mut self, args: Args<'_, Self>, event: WindowEvent)
Advanced handling for window events.
The default impl will pass the event to ImGui and then call window_event
.
Sourcefn device_event(
&mut self,
_args: Args<'_, Self>,
_device_id: DeviceId,
_event: DeviceEvent,
)
fn device_event( &mut self, _args: Args<'_, Self>, _device_id: DeviceId, _event: DeviceEvent, )
A device event has been received.
This event is not handled in any way, just passed laong.
Sourcefn user_event(&mut self, _args: Args<'_, Self>, _event: Self::UserEvent)
fn user_event(&mut self, _args: Args<'_, Self>, _event: Self::UserEvent)
A custom event has been received.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.