Trait Application

Source
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§

Source

const EVENT_FLAGS: EventFlags = _

The EventFlags for this application. Usually the default is ok.

Required Associated Types§

Source

type UserEvent: Send + 'static

The custom event for the EventLoop, usually ().

Source

type Data

The custom data for your AppHandler.

Required Methods§

Source

fn new(args: Args<'_, Self>) -> Self

The main window has been created, please create the application.

Provided Methods§

Source

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.

Source

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.

Source

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.

Source

fn user_event(&mut self, _args: Args<'_, Self>, _event: Self::UserEvent)

A custom event has been received.

Source

fn suspended(&mut self, _args: Args<'_, Self>)

Corresponds to winit `suspended`` function.

Source

fn resumed(&mut self, _args: Args<'_, Self>)

Corresponds to winit resumed function.

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.

Implementors§