pub struct NearestCarDispatch;Expand description
Assigns each call to the nearest idle elevator.
For multi-elevator groups, this overrides decide_all() to coordinate
across the entire group — preventing two elevators from responding to
the same call.
Implementations§
Trait Implementations§
Source§impl Default for NearestCarDispatch
impl Default for NearestCarDispatch
Source§impl DispatchStrategy for NearestCarDispatch
impl DispatchStrategy for NearestCarDispatch
Source§fn decide(
&mut self,
_elevator: EntityId,
_elevator_position: f64,
_group: &ElevatorGroup,
_manifest: &DispatchManifest,
_world: &World,
) -> DispatchDecision
fn decide( &mut self, _elevator: EntityId, _elevator_position: f64, _group: &ElevatorGroup, _manifest: &DispatchManifest, _world: &World, ) -> DispatchDecision
Decide for a single elevator.
Source§fn decide_all(
&mut self,
elevators: &[(EntityId, f64)],
group: &ElevatorGroup,
manifest: &DispatchManifest,
world: &World,
) -> Vec<(EntityId, DispatchDecision)>
fn decide_all( &mut self, elevators: &[(EntityId, f64)], group: &ElevatorGroup, manifest: &DispatchManifest, world: &World, ) -> Vec<(EntityId, DispatchDecision)>
Decide for all idle elevators in a group.
Default: calls
decide() per elevator.Source§fn pre_dispatch(
&mut self,
_group: &ElevatorGroup,
_manifest: &DispatchManifest,
_world: &mut World,
)
fn pre_dispatch( &mut self, _group: &ElevatorGroup, _manifest: &DispatchManifest, _world: &mut World, )
Optional hook called once before the per-group dispatch pass. Read more
Source§fn notify_removed(&mut self, _elevator: EntityId)
fn notify_removed(&mut self, _elevator: EntityId)
Notify the strategy that an elevator has been removed. Read more
Auto Trait Implementations§
impl Freeze for NearestCarDispatch
impl RefUnwindSafe for NearestCarDispatch
impl Send for NearestCarDispatch
impl Sync for NearestCarDispatch
impl Unpin for NearestCarDispatch
impl UnsafeUnpin for NearestCarDispatch
impl UnwindSafe for NearestCarDispatch
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