pub struct MouseTracker { /* private fields */ }Expand description
Tracks mouse boot reports across calls: edge-detects button transitions and accumulates relative motion. There is no on-screen cursor in a text console (that belongs to a future display server), so the driver surfaces events by logging; this struct decides what is worth surfacing and hands it back via closures.
Implementations§
Source§impl MouseTracker
impl MouseTracker
pub const fn new() -> Self
Sourcepub fn feed(
&mut self,
report: &[u8; 8],
on_button: impl FnMut(u8, bool),
on_move: impl FnMut(i32, i32),
)
pub fn feed( &mut self, report: &[u8; 8], on_button: impl FnMut(u8, bool), on_move: impl FnMut(i32, i32), )
Feed one boot report (byte 0 = buttons, byte 1 = dx, byte 2 = dy as signed
deltas). Calls on_button(mask, down) for each of left/right/middle that
changed, and on_move(dx, dy) once accumulated motion crosses a threshold
- a mouse emits far too many move reports to surface each one.
Auto Trait Implementations§
impl Freeze for MouseTracker
impl RefUnwindSafe for MouseTracker
impl Send for MouseTracker
impl Sync for MouseTracker
impl Unpin for MouseTracker
impl UnsafeUnpin for MouseTracker
impl UnwindSafe for MouseTracker
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