Sorter

Trait Sorter 

Source
pub trait Sorter:
    Debug
    + Send
    + Any {
    // Required methods
    fn step(&mut self, budget: usize) -> StepResult;
    fn is_complete(&self) -> bool;
    fn get_telemetry(&self) -> Telemetry;
    fn reset(&mut self, data: Vec<i32>);
    fn name(&self) -> &str;
    fn get_array(&self) -> &[i32];
    fn get_memory_usage(&self) -> usize;
    fn as_any(&self) -> &dyn Any;
    fn as_any_mut(&mut self) -> &mut dyn Any;
}
Expand description

Core trait that all sorting algorithms must implement

Required Methods§

Source

fn step(&mut self, budget: usize) -> StepResult

Execute one step of the sorting algorithm

§Arguments
  • budget - Maximum number of comparisons allowed in this step
§Returns
  • StepResult - Information about operations performed
Source

fn is_complete(&self) -> bool

Check if the algorithm has completed sorting

Source

fn get_telemetry(&self) -> Telemetry

Get current telemetry data

Source

fn reset(&mut self, data: Vec<i32>)

Reset the algorithm with new data

§Arguments
  • data - New array to sort
Source

fn name(&self) -> &str

Get the algorithm’s display name

Source

fn get_array(&self) -> &[i32]

Get current array state (for visualization)

Source

fn get_memory_usage(&self) -> usize

Get auxiliary memory usage in bytes

Source

fn as_any(&self) -> &dyn Any

Support downcasting for type-specific operations

Source

fn as_any_mut(&mut self) -> &mut dyn Any

Support mutable downcasting for type-specific operations

Implementors§