pub trait Elevators {
    // Required methods
    fn get_dest_floors(&self) -> Vec<usize>;
    fn get_energy_spent(&mut self) -> f64;
    fn flush_people_leaving_elevators(&mut self) -> Vec<Vec<Person>>;
    fn update_floors(&mut self);
    fn increment_wait_times(&mut self);
}
Expand description

§Elevators trait

A Elevators implementation is representative of a collection of Elevators. It is implemented by the Building struct.

Required Methods§

Implementations on Foreign Types§

source§

impl Elevators for Vec<Elevator>

source§

fn get_dest_floors(&self) -> Vec<usize>

Get an aggregated list of destination floors across the vector of elevators.

source§

fn get_energy_spent(&mut self) -> f64

Calculate the total energy spent across the vector of elevators.

source§

fn flush_people_leaving_elevators(&mut self) -> Vec<Vec<Person>>

For each elevator, flush anyone leaving the elevator and aggregate each resulting Vec<Person> into a Vec<Vec<Person>>.

source§

fn update_floors(&mut self)

For each elevator, update its floor based on its stopped boolean and its moving_up boolean.

source§

fn increment_wait_times(&mut self)

For each elevator, increment the wait times of the people on the elevator if they are not on their desired floor.

Implementors§