Skip to main content

WindowEventHandler

Trait WindowEventHandler 

Source
pub trait WindowEventHandler: Send + Sync {
    type Host;

    // Required methods
    fn update(&self, host: &mut Self::Host) -> Result<()>;
    fn draw(&self, host: &mut Self::Host) -> Result<()>;

    // Provided methods
    fn key_down_event(
        &self,
        _host: &mut Self::Host,
        _event: KeyboardEvent,
    ) -> Result<()> { ... }
    fn key_up_event(
        &self,
        _host: &mut Self::Host,
        _event: KeyboardEvent,
    ) -> Result<()> { ... }
    fn mouse_motion_event(
        &self,
        _host: &mut Self::Host,
        _event: MouseMotionEvent,
    ) -> Result<()> { ... }
    fn mouse_button_down_event(
        &self,
        _host: &mut Self::Host,
        _event: MouseClickEvent,
    ) -> Result<()> { ... }
    fn mouse_button_up_event(
        &self,
        _host: &mut Self::Host,
        _event: MouseClickEvent,
    ) -> Result<()> { ... }
    fn mouse_wheel_event(
        &self,
        _host: &mut Self::Host,
        _event: MouseWheelEvent,
    ) -> Result<()> { ... }
}

Required Associated Types§

Required Methods§

Source

fn update(&self, host: &mut Self::Host) -> Result<()>

Source

fn draw(&self, host: &mut Self::Host) -> Result<()>

Provided Methods§

Source

fn key_down_event( &self, _host: &mut Self::Host, _event: KeyboardEvent, ) -> Result<()>

Source

fn key_up_event( &self, _host: &mut Self::Host, _event: KeyboardEvent, ) -> Result<()>

Source

fn mouse_motion_event( &self, _host: &mut Self::Host, _event: MouseMotionEvent, ) -> Result<()>

Source

fn mouse_button_down_event( &self, _host: &mut Self::Host, _event: MouseClickEvent, ) -> Result<()>

Source

fn mouse_button_up_event( &self, _host: &mut Self::Host, _event: MouseClickEvent, ) -> Result<()>

Source

fn mouse_wheel_event( &self, _host: &mut Self::Host, _event: MouseWheelEvent, ) -> Result<()>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§