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(
&mut self,
key_stroke: KeyStrokeChar,
) -> Result<bool, TypingEngineError>
pub fn stroke_key( &mut self, key_stroke: KeyStrokeChar, ) -> Result<bool, TypingEngineError>
Give a key stroke to TypingEngine.
If this method is called before initializing via calling start 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.
This method is similar to stroke_key, but it allows specifying the 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
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more