pub struct SplitExecutor { /* private fields */ }Expand description
Stateful conservative split planner and executor.
Implementations§
Source§impl SplitExecutor
impl SplitExecutor
Sourcepub fn new(config: SplitSchedulerConfig) -> Self
pub fn new(config: SplitSchedulerConfig) -> Self
Creates an executor without allocating planning or execution output.
Sourcepub fn plan<'a>(
&'a mut self,
samples: &[StationLoadSample],
current_tick: Tick,
) -> SplitScheduleView<'a>
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}Sourcepub fn planned(&self) -> SplitScheduleView<'_>
pub fn planned(&self) -> SplitScheduleView<'_>
Returns the current planned schedule without executing it.
Sourcepub fn execute_planned<'a>(
&'a mut self,
stations: &mut StationSet,
indexes: &mut StationIndexSet,
ownership: &mut CellOwnershipTable,
) -> Result<SplitScheduleExecutionView<'a>, SplitScheduleExecutionError>
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.
Sourcepub fn retained_capacities(&self) -> SplitExecutorCapacities
pub fn retained_capacities(&self) -> SplitExecutorCapacities
Returns retained planning and execution capacities.
Trait Implementations§
Source§impl Clone for SplitExecutor
impl Clone for SplitExecutor
Source§fn clone(&self) -> SplitExecutor
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)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SplitExecutor
impl Debug for SplitExecutor
Auto Trait Implementations§
impl Freeze for SplitExecutor
impl RefUnwindSafe for SplitExecutor
impl Send for SplitExecutor
impl Sync for SplitExecutor
impl Unpin for SplitExecutor
impl UnsafeUnpin for SplitExecutor
impl UnwindSafe for SplitExecutor
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