Skip to main content

Drill

Struct Drill 

Source
pub struct Drill {
    pub mode: Mode,
    pub stage: usize,
    pub text: Vec<char>,
    pub pos: usize,
    pub keys: u64,
    pub misses: u64,
    pub error: bool,
    pub done: bool,
    /* private fields */
}

Fields§

§mode: Mode§stage: usize§text: Vec<char>§pos: usize§keys: u64§misses: u64§error: bool§done: bool

Implementations§

Source§

impl Drill

Source

pub fn new(mode: Mode, stage: usize, text: String, now: Instant) -> Drill

Source

pub fn expected(&self) -> Option<char>

Source

pub fn started(&self) -> bool

Source

pub fn touch(&mut self, now: Instant)

Restarts the hint clock, for when the drill gets focus.

Source

pub fn press(&mut self, c: char, now: Instant)

Wrong keys don’t advance; they count as a miss on the key you wanted.

Source

pub fn tick(&mut self, now: Instant)

Ends a timed drill once its time is up.

Source

pub fn elapsed(&self, now: Instant) -> Duration

Source

pub fn remaining(&self, now: Instant) -> Option<Duration>

Source

pub fn wpm(&self, now: Instant) -> f64

Source

pub fn accuracy(&self) -> f64

Source

pub fn hesitating(&self, now: Instant) -> bool

Source

pub fn letters(&self) -> &BTreeMap<String, LetterStat>

Source

pub fn pairs(&self) -> &BTreeMap<String, LetterStat>

Timings for each pair of keys typed one after the other.

Source

pub fn typos(&self) -> &BTreeMap<String, u64>

Wrong keys, as “wanted>typed”.

Source

pub fn slowest(&self, n: usize) -> Vec<(char, f64, u64)>

The slowest keys of this drill, for the recall summary.

Auto Trait Implementations§

§

impl Forget for Drill

§

impl Freeze for Drill

§

impl Move for Drill

§

impl RefUnwindSafe for Drill

§

impl Send for Drill

§

impl Sync for Drill

§

impl Unpin for Drill

§

impl UnsafeUnpin for Drill

§

impl UnwindSafe for Drill

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.