Skip to main content

WindowHandler

Trait WindowHandler 

Source
pub trait WindowHandler: 'static {
    // Required methods
    fn on_frame(&self) -> Result<(), HandlerError>;
    fn resized(&self, new_size: WindowSize) -> Result<(), HandlerError>;
    fn on_event(&self, event: Event) -> EventStatus;
}

Required Methods§

Source

fn on_frame(&self) -> Result<(), HandlerError>

Requests the handler to draw a new frame.

If this returns an error, the window will be considered unable to render its contents, and will be subsequently closed.

Source

fn resized(&self, new_size: WindowSize) -> Result<(), HandlerError>

Informs the handler that the window has been resized.

§Errors

This operation can fail, in which case an HandlerError can be returned. This can happen if e.g. an underlying buffer could not be resized, or some kind of driver error.

In case this resized operation fails, baseview will assume that it did not meaningfully change anything, and that the window is still able to render and operate at the previous size.

It will also attempt to resize the underlying platform window and parent window back to the previous size, but this is only a best-effort attempt since those operations can also fail.

Source

fn on_event(&self, event: Event) -> EventStatus

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§