pub struct InputSession {
pub samples: Vec<InputSample>,
pub ended: bool,
pub session_id: u64,
}Expand description
A sequence of input samples forming one button press session
Fields§
§samples: Vec<InputSample>All recorded samples for this session
ended: boolWhether this session has ended (button released)
session_id: u64Session ID for tracking (incremental counter)
Implementations§
Source§impl InputSession
impl InputSession
Sourcepub fn first_sample(&self) -> Option<&InputSample>
pub fn first_sample(&self) -> Option<&InputSample>
Get the first sample in this session
Sourcepub fn last_sample(&self) -> Option<&InputSample>
pub fn last_sample(&self) -> Option<&InputSample>
Get the last sample in this session
Sourcepub fn duration_ms(&self) -> Option<u64>
pub fn duration_ms(&self) -> Option<u64>
Get the duration of this session (first to last sample)
Sourcepub fn total_distance(&self) -> f32
pub fn total_distance(&self) -> f32
Get the total distance traveled in this session
Sourcepub fn direct_distance(&self) -> Option<f32>
pub fn direct_distance(&self) -> Option<f32>
Get the straight-line distance from first to last sample
Trait Implementations§
Source§impl Clone for InputSession
impl Clone for InputSession
Source§fn clone(&self) -> InputSession
fn clone(&self) -> InputSession
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InputSession
impl Debug for InputSession
Source§impl PartialEq for InputSession
impl PartialEq for InputSession
impl StructuralPartialEq for InputSession
Auto Trait Implementations§
impl Freeze for InputSession
impl RefUnwindSafe for InputSession
impl Send for InputSession
impl Sync for InputSession
impl Unpin for InputSession
impl UnwindSafe for InputSession
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more