#[non_exhaustive]pub struct MouseEvent {
pub kind: MouseKind,
pub x: u32,
pub y: u32,
pub modifiers: KeyModifiers,
pub pixel_x: Option<u16>,
pub pixel_y: Option<u16>,
}Expand description
A mouse event with position and kind.
Coordinates are zero-based terminal columns (x) and rows (y).
pixel_x and pixel_y are reserved for future sub-cell precision
(e.g. Kitty pixel mouse protocol, WASM backend); they are currently
always None with the crossterm backend, since SGR 1006 only reports
cell coordinates and crossterm 0.28 has no pixel mouse fields.
Mouse events are only produced when mouse: true is set in
crate::RunConfig.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.kind: MouseKindThe type of mouse action that occurred.
x: u32Column (horizontal position), zero-based.
y: u32Row (vertical position), zero-based.
modifiers: KeyModifiersModifier keys held at the time of the event.
pixel_x: Option<u16>Pixel-level x coordinate (reserved).
Currently always None with the crossterm backend; populated only
when a Kitty-capable or WASM backend provides sub-cell precision.
pixel_y: Option<u16>Pixel-level y coordinate (reserved).
Currently always None with the crossterm backend; populated only
when a Kitty-capable or WASM backend provides sub-cell precision.
Implementations§
Trait Implementations§
Source§impl Clone for MouseEvent
impl Clone for MouseEvent
Source§fn clone(&self) -> MouseEvent
fn clone(&self) -> MouseEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MouseEvent
impl Debug for MouseEvent
impl Eq for MouseEvent
Source§impl PartialEq for MouseEvent
impl PartialEq for MouseEvent
Source§fn eq(&self, other: &MouseEvent) -> bool
fn eq(&self, other: &MouseEvent) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for MouseEvent
Auto Trait Implementations§
impl Freeze for MouseEvent
impl RefUnwindSafe for MouseEvent
impl Send for MouseEvent
impl Sync for MouseEvent
impl Unpin for MouseEvent
impl UnsafeUnpin for MouseEvent
impl UnwindSafe for MouseEvent
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.