Skip to main content

PressEvent

Trait PressEvent 

Source
pub trait PressEvent: Sized {
    // Required methods
    fn from_button(button: Button, old_event: &Self) -> Option<Self>;
    fn press<U, F>(&self, f: F) -> Option<U>
       where F: FnMut(Button) -> U;

    // Provided method
    fn press_args(&self) -> Option<Button> { ... }
}
Expand description

The press of a button.

Required Methods§

Source

fn from_button(button: Button, old_event: &Self) -> Option<Self>

Creates a press event.

Preserves scancode from original button event, if any. Preserves time stamp from original input event, if any.

Source

fn press<U, F>(&self, f: F) -> Option<U>
where F: FnMut(Button) -> U,

Calls closure if this is a press event.

Provided Methods§

Source

fn press_args(&self) -> Option<Button>

Returns press arguments.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<T> PressEvent for T
where T: ButtonEvent,