Skip to main content

HostCallbacks

Trait HostCallbacks 

Source
pub trait HostCallbacks: 'static {
    // Required methods
    fn request_resize(
        &mut self,
        new_size: WindowSize,
    ) -> Result<(), HandlerError>;
    fn destroyed(&mut self);
}
Expand description

A handler for baseview windows to interact with their host.

Required Methods§

Source

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

Requests the parent window to be resized to accommodate the child window with the given new size.

§Errors

This can return any type of error, indicating the host either failed or denied to handle the resize request. If it does, the error is logged and the resize operation is canceled or reverted.

Source

fn destroyed(&mut self)

Notifies the host that the child window has been destroyed for a reason outside the host’s control.

This can be because the display connection was lost, because the window handler crashed, or because the window handler decided to close the window itself.

The host should close its parent window, as it will not show anything useful anymore.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§