#[non_exhaustive]pub struct MouseEvent {
pub kind: MouseEventKind,
pub position: Pos,
pub pixel_position: Option<PhysicalPos>,
pub modifiers: KeyModifiers,
}Expand description
Mouse input event.
Does not derive Eq/Hash: MouseEventKind does not (its Scroll variant’s f32
fields implement neither).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.kind: MouseEventKindThe kind of mouse event.
position: PosCell-grid position of the mouse cursor.
pixel_position: Option<PhysicalPos>Physical pixel position of the mouse cursor, relative to the window’s top-left.
Populated by backends that support sub-cell precision (e.g. the software
renderer). None on character-mode backends such as crossterm.
modifiers: KeyModifiersModifiers held down during the event.
Implementations§
Source§impl MouseEvent
impl MouseEvent
Sourcepub const fn new(
kind: MouseEventKind,
position: Pos,
modifiers: KeyModifiers,
) -> Self
pub const fn new( kind: MouseEventKind, position: Pos, modifiers: KeyModifiers, ) -> Self
Creates a mouse event at the given cell-grid position, with no pixel position.
Sourcepub const fn with_pixel_position(
kind: MouseEventKind,
position: Pos,
modifiers: KeyModifiers,
pixel_position: PhysicalPos,
) -> Self
pub const fn with_pixel_position( kind: MouseEventKind, position: Pos, modifiers: KeyModifiers, pixel_position: PhysicalPos, ) -> Self
Creates a mouse event with an explicit pixel position, for backends with sub-cell precision.
Trait Implementations§
Source§impl Clone for MouseEvent
impl Clone for MouseEvent
Source§fn clone(&self) -> MouseEvent
fn clone(&self) -> MouseEvent
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 MouseEvent
Source§impl Debug for MouseEvent
impl Debug for MouseEvent
Source§impl PartialEq for MouseEvent
impl PartialEq for MouseEvent
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
Mutably borrows from an owned value. Read more