#[non_exhaustive]pub enum MouseEventKind {
Down(MouseButton),
Up(MouseButton),
Drag(MouseButton),
Moved,
Scroll {
dx: f32,
dy: f32,
},
}Expand description
Kinds of mouse events.
Does not derive Eq/Hash: Scroll’s f32 fields implement neither.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Down(MouseButton)
Mouse button pressed.
Up(MouseButton)
Mouse button released.
Drag(MouseButton)
Mouse moved while a button was held down; carries which button.
Moved
Mouse moved.
Scroll
Mouse wheel/touchpad scroll.
dy > 0.0 is scroll up, dy < 0.0 is scroll down; dx > 0.0 is scroll right, dx < 0.0
is scroll left (mostly from a laptop touchpad). Magnitude is backend-dependent: the winit
backend reports the exact pixel/line delta from the platform, while the crossterm backend
synthesizes a fixed step of 1.0 per tick since terminals can’t report scroll precision.
Trait Implementations§
Source§impl Clone for MouseEventKind
impl Clone for MouseEventKind
Source§fn clone(&self) -> MouseEventKind
fn clone(&self) -> MouseEventKind
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for MouseEventKind
Source§impl Debug for MouseEventKind
impl Debug for MouseEventKind
Source§impl PartialEq for MouseEventKind
impl PartialEq for MouseEventKind
impl StructuralPartialEq for MouseEventKind
Auto Trait Implementations§
impl Freeze for MouseEventKind
impl RefUnwindSafe for MouseEventKind
impl Send for MouseEventKind
impl Sync for MouseEventKind
impl Unpin for MouseEventKind
impl UnsafeUnpin for MouseEventKind
impl UnwindSafe for MouseEventKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more