Skip to main content

LookDispatch

Struct LookDispatch 

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

Elevator dispatch using the LOOK algorithm.

Like SCAN, but reverses at the last request in the current direction instead of traveling to the end of the shaft. More efficient than pure SCAN for sparse request distributions.

This is the standard “elevator algorithm” used in real buildings.

Implementations§

Source§

impl LookDispatch

Source

pub fn new() -> Self

Create a new LookDispatch with no initial direction state.

Trait Implementations§

Source§

impl Default for LookDispatch

Source§

fn default() -> Self

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

impl DispatchStrategy for LookDispatch

Source§

fn decide( &mut self, elevator: EntityId, elevator_position: f64, group: &ElevatorGroup, manifest: &DispatchManifest, world: &World, ) -> DispatchDecision

Decide for a single elevator.
Source§

fn notify_removed(&mut self, elevator: EntityId)

Notify the strategy that an elevator has been removed. Read more
Source§

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.

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> 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, 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.