Skip to main content

SplitExecutor

Struct SplitExecutor 

Source
pub struct SplitExecutor { /* private fields */ }
Expand description

Stateful conservative split planner and executor.

Implementations§

Source§

impl SplitExecutor

Source

pub fn new(config: SplitSchedulerConfig) -> Self

Creates an executor without allocating planning or execution output.

Source

pub fn plan<'a>( &'a mut self, samples: &[StationLoadSample], current_tick: Tick, ) -> SplitScheduleView<'a>

Plans into retained storage and returns the active borrowed schedule.

Examples found in repository?
examples/maintenance_flow.rs (line 15)
6fn main() {
7    let mut stations = StationSet::default();
8    let indexes = StationIndexSet::default();
9    let mut router = EventRouter::default();
10
11    let mut sampler = LoadSampler::default();
12    let load = sampler.sample(&stations, &indexes, &router, &[]);
13
14    let mut splits = SplitExecutor::default();
15    let schedule = splits.plan(load, Tick::new(1));
16    let mut station_execution = StationExecutor::default();
17    let advances = station_execution
18        .advance_loaded(&mut stations, load)
19        .stations_selected;
20    let ready_events = station_execution
21        .drain_ready_events(&stations, &mut router)
22        .expect("empty event drain should work")
23        .len();
24
25    println!("samples={}", load.len());
26    println!("split_actions={}", schedule.actions.len());
27    println!("station_advances={advances}");
28    println!("ready_events={ready_events}");
29}
Source

pub fn planned(&self) -> SplitScheduleView<'_>

Returns the current planned schedule without executing it.

Source

pub fn execute_planned<'a>( &'a mut self, stations: &mut StationSet, indexes: &mut StationIndexSet, ownership: &mut CellOwnershipTable, ) -> Result<SplitScheduleExecutionView<'a>, SplitScheduleExecutionError>

Executes the current plan and records successful actions for cooldown.

Source

pub fn retained_capacities(&self) -> SplitExecutorCapacities

Returns retained planning and execution capacities.

Trait Implementations§

Source§

impl Clone for SplitExecutor

Source§

fn clone(&self) -> SplitExecutor

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SplitExecutor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SplitExecutor

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.