pub struct Progress {
pub stage: usize,
pub runs: Vec<Run>,
pub manual: BTreeMap<String, Manual>,
pub letters: BTreeMap<String, BTreeMap<String, LetterStat>>,
pub pairs: BTreeMap<String, BTreeMap<String, LetterStat>>,
pub warmed_up: Option<String>,
}Fields§
§stage: usize§runs: Vec<Run>§manual: BTreeMap<String, Manual>Keyed by stage number as a string.
letters: BTreeMap<String, BTreeMap<String, LetterStat>>Stage number, then the character, both as strings.
pairs: BTreeMap<String, BTreeMap<String, LetterStat>>Stage number, then two characters typed one after the other: how long the second took after the first, and how often it was missed there.
warmed_up: Option<String>The local date of the last warm-up, as YYYY-MM-DD.
Implementations§
Source§impl Progress
impl Progress
pub fn load(path: &Path) -> Result<Progress>
pub fn parse(text: &str) -> Result<Progress>
Sourcepub fn save(&self, path: &Path) -> Result<()>
pub fn save(&self, path: &Path) -> Result<()>
Writes to a temporary file first so a crash never leaves half a file.
pub fn manual(&self, stage: usize) -> Manual
pub fn manual_mut(&mut self, stage: usize) -> &mut Manual
pub fn letters(&self, stage: usize) -> BTreeMap<String, LetterStat>
pub fn runs_for(&self, stage: usize, mode: &str) -> Vec<&Run>
Sourcepub fn baseline(&self) -> Option<f64>
pub fn baseline(&self) -> Option<f64>
Average of the last three stage-0 real-text runs, or the number typed in.
pub fn pairs(&self, stage: usize) -> BTreeMap<String, LetterStat>
Sourcepub fn record(&mut self, run: Run, pairs: &BTreeMap<String, LetterStat>)
pub fn record(&mut self, run: Run, pairs: &BTreeMap<String, LetterStat>)
Saves a run, adding its letters (and the drill’s pairs) to the stage’s totals.
Sourcepub fn merge(&mut self, other: Progress) -> usize
pub fn merge(&mut self, other: Progress) -> usize
Folds another progress file (such as a web tutor backup) into this one. Runs are deduplicated by time, stage and drill; ticked boxes stay ticked; letter timings are only taken for stages that have none yet, so importing the same backup twice doesn’t double them.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Progress
impl<'de> Deserialize<'de> for Progress
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for Progress
Auto Trait Implementations§
impl Forget for Progress
impl Freeze for Progress
impl Move for Progress
impl RefUnwindSafe for Progress
impl Send for Progress
impl Sync for Progress
impl Unpin for Progress
impl UnsafeUnpin for Progress
impl UnwindSafe for Progress
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> ⓘ
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> ⓘ
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