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§
Provided Methods§
Sourcefn configure_imgui(
&mut self,
_context: &mut InitContext<'_>,
) -> Result<(), RunError>
fn configure_imgui( &mut self, _context: &mut InitContext<'_>, ) -> Result<(), RunError>
Configures the one stable Dear ImGui context before renderer initialization.
Sourcefn initialized(
&mut self,
_context: &mut InitializedContext<'_>,
_gpu: &mut GpuContext<'_>,
) -> Result<(), RunError>
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.
Sourcefn gpu_lost(&mut self, _context: &mut GpuContext<'_>) -> Result<(), RunError>
fn gpu_lost(&mut self, _context: &mut GpuContext<'_>) -> Result<(), RunError>
Runs before the old GPU generation is invalidated and destroyed.
Sourcefn gpu_recreated(
&mut self,
_context: &mut GpuContext<'_>,
) -> Result<(), RunError>
fn gpu_recreated( &mut self, _context: &mut GpuContext<'_>, ) -> Result<(), RunError>
Runs after a replacement GPU generation has been committed.
Sourcefn event(&mut self, _context: &mut EventContext<'_>) -> Result<(), RunError>
fn event(&mut self, _context: &mut EventContext<'_>) -> Result<(), RunError>
Receives events for the live main window only.
Sourcefn prepare_frame(
&mut self,
_context: &mut PrepareFrameContext<'_>,
) -> Result<(), RunError>
fn prepare_frame( &mut self, _context: &mut PrepareFrameContext<'_>, ) -> Result<(), RunError>
Mutates Context-owned resources before Dear ImGui opens the next frame.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".