pub struct PracticeSession { /* private fields */ }Expand description
A walk through a lesson’s practice questions.
Implementations§
Source§impl PracticeSession
impl PracticeSession
Sourcepub fn new(total: usize, completed: impl IntoIterator<Item = usize>) -> Self
pub fn new(total: usize, completed: impl IntoIterator<Item = usize>) -> Self
A session over total questions. completed are questions answered right before: the walk
starts at the first one not in it.
pub fn total(&self) -> usize
Sourcepub fn completed_count(&self) -> usize
pub fn completed_count(&self) -> usize
Questions answered right, in this session or an earlier one.
pub fn is_completed(&self, index: usize) -> bool
Sourcepub fn visit(&self) -> usize
pub fn visit(&self) -> usize
Counts arrivals: every Next or Skip starts a new visit, even when it lands back on the same question, so a view keyed by it always opens a question with a blank answer.
Sourcepub fn solved_current(&self) -> bool
pub fn solved_current(&self) -> bool
Whether the question on screen has been answered right since it came up.
Sourcepub fn is_revealed(&self) -> bool
pub fn is_revealed(&self) -> bool
Whether the answer to the question on screen has been shown.
Sourcepub fn pending_retries(&self) -> Vec<usize>
pub fn pending_retries(&self) -> Vec<usize>
Missed questions waiting to come back, in the order they will.
Sourcepub fn answer(&mut self, correct: bool)
pub fn answer(&mut self, correct: bool)
Grade the question on screen. A wrong answer to a question not yet completed queues it to come
back after RETRY_GAP others.
Sourcepub fn reveal_answer(&mut self)
pub fn reveal_answer(&mut self)
Show the answer to the question on screen.
Trait Implementations§
Source§impl Clone for PracticeSession
impl Clone for PracticeSession
Source§fn clone(&self) -> PracticeSession
fn clone(&self) -> PracticeSession
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PracticeSession
impl Debug for PracticeSession
Source§impl PartialEq for PracticeSession
impl PartialEq for PracticeSession
impl StructuralPartialEq for PracticeSession
Auto Trait Implementations§
impl Freeze for PracticeSession
impl RefUnwindSafe for PracticeSession
impl Send for PracticeSession
impl Sync for PracticeSession
impl Unpin for PracticeSession
impl UnsafeUnpin for PracticeSession
impl UnwindSafe for PracticeSession
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.