Skip to main content

Application

Trait Application 

Source
pub trait Application {
    // Required method
    fn frame(&mut self, context: &mut FrameContext<'_>) -> Result<(), RunError>;

    // Provided methods
    fn configure_imgui(
        &mut self,
        _context: &mut InitContext<'_>,
    ) -> Result<(), RunError> { ... }
    fn initialized(
        &mut self,
        _context: &mut InitializedContext<'_>,
        _gpu: &mut GpuContext<'_>,
    ) -> Result<(), RunError> { ... }
    fn gpu_lost(
        &mut self,
        _context: &mut GpuContext<'_>,
    ) -> Result<(), RunError> { ... }
    fn gpu_recreated(
        &mut self,
        _context: &mut GpuContext<'_>,
    ) -> Result<(), RunError> { ... }
    fn event(&mut self, _context: &mut EventContext<'_>) -> Result<(), RunError> { ... }
    fn prepare_frame(
        &mut self,
        _context: &mut PrepareFrameContext<'_>,
    ) -> Result<(), RunError> { ... }
    fn shutdown(
        &mut self,
        _context: &mut ShutdownContext<'_>,
    ) -> Result<(), RunError> { ... }
}
Expand description

Persistent user application. This value survives every GPU recreation.

The runtime wraps every hook failure with the matching ApplicationStage while retaining the returned RunError as its source. Hooks therefore return the most specific error they have instead of formatting callback names into messages.

Required Methods§

Source

fn frame(&mut self, context: &mut FrameContext<'_>) -> Result<(), RunError>

Builds one Dear ImGui frame.

Provided Methods§

Source

fn configure_imgui( &mut self, _context: &mut InitContext<'_>, ) -> Result<(), RunError>

Configures the one stable Dear ImGui context before renderer initialization.

Source

fn initialized( &mut self, _context: &mut InitializedContext<'_>, _gpu: &mut GpuContext<'_>, ) -> Result<(), RunError>

Runs exactly once after the window, UI state, and first GPU generation are ready.

Source

fn gpu_lost(&mut self, _context: &mut GpuContext<'_>) -> Result<(), RunError>

Runs before the old GPU generation is invalidated and destroyed.

Source

fn gpu_recreated( &mut self, _context: &mut GpuContext<'_>, ) -> Result<(), RunError>

Runs after a replacement GPU generation has been committed.

Source

fn event(&mut self, _context: &mut EventContext<'_>) -> Result<(), RunError>

Receives events for the live main window only.

Source

fn prepare_frame( &mut self, _context: &mut PrepareFrameContext<'_>, ) -> Result<(), RunError>

Mutates Context-owned resources before Dear ImGui opens the next frame.

Source

fn shutdown( &mut self, _context: &mut ShutdownContext<'_>, ) -> Result<(), RunError>

Runs exactly once before add-ons and the Dear ImGui context are torn down.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§