pub struct App {
pub flipped: bool,
pub opts: Opts,
pub text: String,
/* private fields */
}Expand description
App holds the state of the application
Fields§
§flipped: boolThis determines whether the card should show the question or the answer.
opts: OptsThe (command line) options of the App to determine
how it willl run.
text: StringThe currently entered text for Input questions. Reset when moving to a new questions.
Implementations§
Source§impl App
impl App
Sourcepub fn order_playables(&mut self)
pub fn order_playables(&mut self)
Put the playable cards in order based of their score
Sourcepub fn dues(&self) -> HashMap<CardIdx, Option<DateTime<Utc>>>
pub fn dues(&self) -> HashMap<CardIdx, Option<DateTime<Utc>>>
Returns in immutable copy of when different cards are due.
The key is garunteed to probably be an index from [Self::cards]
Sourcepub fn scores(&self) -> HashMap<usize, usize>
pub fn scores(&self) -> HashMap<usize, usize>
Returns in immutable copy of each cards scores.
The key is garunteed to probably be an index from [Self::cards]
Sourcepub fn circulating(&self) -> &[CardIdx] ⓘ
pub fn circulating(&self) -> &[CardIdx] ⓘ
Returns a copy of cards which are mandatorily in circulation until answered correctly
Sourcepub fn playable_range(&self) -> usize
pub fn playable_range(&self) -> usize
Gets the range of cards currently being played with.
Sourcepub fn shuffle_all(&mut self)
pub fn shuffle_all(&mut self)
Shuffles the whole deck so you can play with different cards
Sourcepub fn retain_undue(&mut self)
pub fn retain_undue(&mut self)
Removes any cards which aren’t due from the deck
Sourcepub fn card_score(&self) -> usize
pub fn card_score(&self) -> usize
Gets the score of the current card from the app.
Sourcepub fn reset_current_card_duration(&mut self)
pub fn reset_current_card_duration(&mut self)
Resets the duration of the current card.
This will index DURATIONS and work out from that
how far forth it should be due.
Sourcepub fn change_current_card_score(&mut self, val: isize)
pub fn change_current_card_score(&mut self, val: isize)
Changes the score of the current card.
A card can not have a negative score. If the
zeroize option is true then a negative val
will set the score to zero.
Sourcepub fn current_card_is_finished(&self, card: usize) -> bool
pub fn current_card_is_finished(&self, card: usize) -> bool
Determines if the current card still should be played or if its due date has expired.
Sourcepub fn unfinished_count(&self) -> usize
pub fn unfinished_count(&self) -> usize
Gets how many cards still need to be played.
Sourcepub fn write_scores(&self) -> Result<()>
pub fn write_scores(&self) -> Result<()>
Writes the scores recursively to the relevant files, as specified in App::opts.
Sourcepub fn add_scores(&mut self, scores: Scores, path: &Path)
pub fn add_scores(&mut self, scores: Scores, path: &Path)
Adds a [flashed::Scores] into an App
Sourcepub fn read_scores(&mut self) -> Result<()>
pub fn read_scores(&mut self) -> Result<()>
Reads and applies the scores from the file or directory, as specified in App::opts
Sourcepub fn scores_from_path(&self, path: &Path) -> Scores
pub fn scores_from_path(&self, path: &Path) -> Scores
Gets the scores for all cards with the given path