pub struct Toipe { /* private fields */ }
Expand description
Typing test terminal UI and logic.
Implementations§
source§impl<'a> Toipe
impl<'a> Toipe
sourcepub fn new(config: ToipeConfig) -> Result<Self>
pub fn new(config: ToipeConfig) -> Result<Self>
Initializes a new typing test on the standard output.
See ToipeConfig
for configuration options.
Initializes the word selector.
Also invokes Toipe::restart()
.
sourcepub fn restart(&mut self) -> Result<()>
pub fn restart(&mut self) -> Result<()>
Make the terminal ready for the next typing test.
Clears the screen, generates new words and displays them on the UI.
sourcepub fn test(&mut self, stdin: StdinLock<'a>) -> Result<(bool, ToipeResults)>
pub fn test(&mut self, stdin: StdinLock<'a>) -> Result<(bool, ToipeResults)>
Start typing test by monitoring input keys.
Must only be invoked after Toipe::restart()
.
If the test completes successfully, returns a boolean indicating
whether the user wants to do another test and the
ToipeResults
for this test.
Auto Trait Implementations§
impl !RefUnwindSafe for Toipe
impl !Send for Toipe
impl !Sync for Toipe
impl Unpin for Toipe
impl !UnwindSafe for Toipe
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