pub struct RaceController { /* private fields */ }
Expand description
Main controller for orchestrating the sorting race
Implementations§
Source§impl RaceController
impl RaceController
Sourcepub fn new(
algorithms: Vec<Box<dyn Sorter>>,
fairness_model: Box<dyn FairnessModel>,
max_snapshots: usize,
) -> Self
pub fn new( algorithms: Vec<Box<dyn Sorter>>, fairness_model: Box<dyn FairnessModel>, max_snapshots: usize, ) -> Self
Create a new race controller
Sourcepub fn start_race(
&mut self,
config: &RunConfiguration,
data: Vec<i32>,
) -> Result<(), String>
pub fn start_race( &mut self, config: &RunConfiguration, data: Vec<i32>, ) -> Result<(), String>
Start the race with the given configuration
Sourcepub fn run_to_completion(&mut self, max_steps: Option<usize>) -> usize
pub fn run_to_completion(&mut self, max_steps: Option<usize>) -> usize
Run the race to completion or until a step limit
Sourcepub fn is_race_complete(&self) -> bool
pub fn is_race_complete(&self) -> bool
Check if the race is complete
Sourcepub fn get_current_step(&self) -> usize
pub fn get_current_step(&self) -> usize
Get current step number
Sourcepub fn get_elapsed_time(&self) -> Option<Duration>
pub fn get_elapsed_time(&self) -> Option<Duration>
Get elapsed time since race start
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Check if race is running
Sourcepub fn get_algorithms(&self) -> &[Box<dyn Sorter>]
pub fn get_algorithms(&self) -> &[Box<dyn Sorter>]
Get reference to algorithms
Sourcepub fn get_snapshot_service(&self) -> &SnapshotService
pub fn get_snapshot_service(&self) -> &SnapshotService
Get reference to snapshot service
Sourcepub fn get_snapshot_service_mut(&mut self) -> &mut SnapshotService
pub fn get_snapshot_service_mut(&mut self) -> &mut SnapshotService
Get mutable reference to snapshot service
Sourcepub fn get_fairness_model_name(&self) -> &str
pub fn get_fairness_model_name(&self) -> &str
Get the name of the current fairness model
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RaceController
impl !RefUnwindSafe for RaceController
impl !Send for RaceController
impl !Sync for RaceController
impl Unpin for RaceController
impl !UnwindSafe for RaceController
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> 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