pub struct SessionState {
pub current_config: ConfigurationState,
pub run_history: Vec<RaceResult>,
pub session_start_time: Instant,
pub total_races_run: u32,
/* private fields */
}
Expand description
Session state managing multiple sorting races
Fields§
§current_config: ConfigurationState
Current configuration settings
run_history: Vec<RaceResult>
History of completed race results
session_start_time: Instant
When the session started
total_races_run: u32
Total number of races run in this session
Implementations§
Source§impl SessionState
impl SessionState
Sourcepub fn start_new_race(&mut self) -> Result<(), Error>
pub fn start_new_race(&mut self) -> Result<(), Error>
Start a new race with current configuration
Sourcepub fn complete_current_race(&mut self)
pub fn complete_current_race(&mut self)
Complete the current race and add it to history
Sourcepub fn update_race_progress(&mut self, algorithms: &[Box<dyn Sorter>])
pub fn update_race_progress(&mut self, algorithms: &[Box<dyn Sorter>])
Update current race progress
Sourcepub fn has_current_race(&self) -> bool
pub fn has_current_race(&self) -> bool
Check if there’s a current race in progress
Sourcepub fn get_current_race(&self) -> Option<&RaceResult>
pub fn get_current_race(&self) -> Option<&RaceResult>
Get current race result (if any)
Sourcepub fn get_current_race_mut(&mut self) -> Option<&mut RaceResult>
pub fn get_current_race_mut(&mut self) -> Option<&mut RaceResult>
Get mutable reference to current race result
Sourcepub fn get_session_duration(&self) -> Duration
pub fn get_session_duration(&self) -> Duration
Get session duration
Sourcepub fn get_race_statistics(&self) -> SessionStatistics
pub fn get_race_statistics(&self) -> SessionStatistics
Get race statistics
Sourcepub fn update_configuration(&mut self, config: ConfigurationState)
pub fn update_configuration(&mut self, config: ConfigurationState)
Update current configuration
Sourcepub fn clear_history(&mut self)
pub fn clear_history(&mut self)
Clear session history
Sourcepub fn get_average_race_duration(&self) -> Option<Duration>
pub fn get_average_race_duration(&self) -> Option<Duration>
Get average race duration
Sourcepub fn get_most_common_winner(&self) -> Option<AlgorithmType>
pub fn get_most_common_winner(&self) -> Option<AlgorithmType>
Get most common winner
Trait Implementations§
Source§impl Clone for SessionState
impl Clone for SessionState
Source§fn clone(&self) -> SessionState
fn clone(&self) -> SessionState
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 SessionState
impl Debug for SessionState
Auto Trait Implementations§
impl Freeze for SessionState
impl RefUnwindSafe for SessionState
impl Send for SessionState
impl Sync for SessionState
impl Unpin for SessionState
impl UnwindSafe for SessionState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more