kludgine::app

Trait Application

pub trait Application<AppMessage>: ApplicationSealed<AppMessage>
where AppMessage: Message,
{ // Required methods fn app(&self) -> App<AppMessage>; fn send( &mut self, message: AppMessage, ) -> Option<<AppMessage as Message>::Response>; fn send_error( &mut self, error: <AppMessage as Message>::Error, ) -> Result<(), EventLoopClosed<<AppMessage as Message>::Error>>; }
Expand description

A type that has a handle to the application thread.

Required Methods§

fn app(&self) -> App<AppMessage>

Returns a handle to the running application.

fn send( &mut self, message: AppMessage, ) -> Option<<AppMessage as Message>::Response>

Sends an app message to the main event loop to be handled by the callback provided when the app was created.

This function will return None if the main event loop is no longer running. Otherwise, this function will block until the result of the callback has been received.

fn send_error( &mut self, error: <AppMessage as Message>::Error, ) -> Result<(), EventLoopClosed<<AppMessage as Message>::Error>>

Sends an error to the event loop.

§Errors

Returns an error if the event loop is not currently running.

Implementors§

§

impl<AppMessage> Application<AppMessage> for App<AppMessage>
where AppMessage: Message,

§

impl<AppMessage> Application<AppMessage> for PendingApp<AppMessage>
where AppMessage: Message,

§

impl<AppMessage> Application<AppMessage> for RunningWindow<AppMessage>
where AppMessage: Message,