pub struct TypingEngine { /* private fields */ }
Expand description
The main engine of typing game.
Implementations§
Source§impl TypingEngine
impl TypingEngine
Sourcepub fn init(&mut self, query_request: QueryRequest<'_>)
pub fn init(&mut self, query_request: QueryRequest<'_>)
Initialize TypingEngine
by constructing and resetting query using QueryRequest
.
Sourcepub fn append_query(
&mut self,
query_request: QueryRequest<'_>,
) -> Result<(), TypingEngineError>
pub fn append_query( &mut self, query_request: QueryRequest<'_>, ) -> Result<(), TypingEngineError>
Append query using QueryRequest
.
If this method is called before initializing via calling init
method, this
method returns error.
Sourcepub fn start(&mut self) -> Result<(), TypingEngineError>
pub fn start(&mut self) -> Result<(), TypingEngineError>
Start typing.
If this method is called before initializing via calling init
method, this
method returns error.
Sourcepub fn stroke_key_with_elapsed_time(
&mut self,
key_stroke: KeyStrokeChar,
elapsed_time: Duration,
) -> Result<bool, TypingEngineError>
pub fn stroke_key_with_elapsed_time( &mut self, key_stroke: KeyStrokeChar, elapsed_time: Duration, ) -> Result<bool, TypingEngineError>
Give a key stroke to TypingEngine
with a specified elapsed time.
Sourcepub fn construct_display_info(
&self,
lap_request: LapRequest,
) -> Result<DisplayInfo, TypingEngineError>
pub fn construct_display_info( &self, lap_request: LapRequest, ) -> Result<DisplayInfo, TypingEngineError>
Construct DisplayInfo
for composing UI.
If this method is called before starting via calling start
method,
this method returns error.
Sourcepub fn construct_result(
&self,
lap_request: LapRequest,
) -> Result<TypingResult, TypingEngineError>
pub fn construct_result( &self, lap_request: LapRequest, ) -> Result<TypingResult, TypingEngineError>
Construct TypingResult
.
This method must be called when typing is finished.
Trait Implementations§
Source§impl Clone for TypingEngine
impl Clone for TypingEngine
Source§fn clone(&self) -> TypingEngine
fn clone(&self) -> TypingEngine
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for TypingEngine
impl Debug for TypingEngine
Source§impl Default for TypingEngine
impl Default for TypingEngine
Source§impl Hash for TypingEngine
impl Hash for TypingEngine
Source§impl PartialEq for TypingEngine
impl PartialEq for TypingEngine
impl Eq for TypingEngine
impl StructuralPartialEq for TypingEngine
Auto Trait Implementations§
impl Freeze for TypingEngine
impl RefUnwindSafe for TypingEngine
impl Send for TypingEngine
impl Sync for TypingEngine
impl Unpin for TypingEngine
impl UnwindSafe for TypingEngine
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