Enum sim::mechanics::parking::ParkingSimState

source ·
pub enum ParkingSimState {
    Normal(NormalParkingSimState),
    Infinite(InfiniteParkingSimState),
}

Variants§

Implementations§

source§

impl ParkingSimState

source

pub fn new(map: &Map, infinite: bool, timer: &mut Timer<'_>) -> ParkingSimState

Counterintuitive: any spots located in blackholes are just not represented here. If somebody tries to drive from a blackholed spot, they couldn’t reach most places.

source

pub fn is_infinite(&self) -> bool

Trait Implementations§

source§

impl Clone for ParkingSimState

source§

fn clone(&self) -> ParkingSimState

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<'de> Deserialize<'de> for ParkingSimState

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl From<InfiniteParkingSimState> for ParkingSimState

source§

fn from(v: InfiniteParkingSimState) -> ParkingSimState

Converts to this type from the input type.
source§

impl From<NormalParkingSimState> for ParkingSimState

source§

fn from(v: NormalParkingSimState) -> ParkingSimState

Converts to this type from the input type.
source§

impl ParkingSim for ParkingSimState

source§

fn handle_live_edits( &mut self, __enum_dispatch_arg_0: &Map, __enum_dispatch_arg_1: &mut Timer<'_> ) -> (Vec<ParkedCar>, Vec<CarID>)

Returns any cars that got very abruptly evicted from existence, and also cars actively moving into a deleted spot.

source§

fn unreserve_spot(&mut self, __enum_dispatch_arg_0: CarID)

Needed when abruptly deleting a car, in case they’re being deleted during their last step.

source§

fn canonical_pt( &self, __enum_dispatch_arg_0: CarID, __enum_dispatch_arg_1: &Map ) -> Option<Pt2D>

There’s no DrawCarInput for cars parked offstreet, so we need this.

source§

fn get_all_free_spots( &self, __enum_dispatch_arg_0: Position, __enum_dispatch_arg_1: &Vehicle, __enum_dispatch_arg_2: BuildingID, __enum_dispatch_arg_3: &Map ) -> Vec<(ParkingSpot, Position)>

The vehicle’s front is currently at the given driving_pos. Returns all valid spots and their driving position.

source§

fn get_all_parking_spots(&self) -> (Vec<ParkingSpot>, Vec<ParkingSpot>)

(Filled, available)

source§

fn path_to_free_parking_spot( &self, __enum_dispatch_arg_0: LaneID, __enum_dispatch_arg_1: &Vehicle, __enum_dispatch_arg_2: BuildingID, __enum_dispatch_arg_3: &Map ) -> Option<(Vec<PathStep>, ParkingSpot, Position)>

Unrealistically assumes the driver has knowledge of currently free parking spots, even if they’re far away. Since they don’t reserve the spot in advance, somebody else can still beat them there, producing some nice, realistic churn if there’s too much contention. But the implementation has some internal jitter between different vehicles, to discourage everybody near one spot from all competing for it. Note the first PathStep is the turn after start, NOT PathStep::Lane(start).

source§

fn get_free_onstreet_spots( &self, __enum_dispatch_arg_0: LaneID ) -> Vec<ParkingSpot>

source§

fn get_free_offstreet_spots( &self, __enum_dispatch_arg_0: BuildingID ) -> Vec<ParkingSpot>

source§

fn get_free_lot_spots( &self, __enum_dispatch_arg_0: ParkingLotID ) -> Vec<ParkingSpot>

source§

fn reserve_spot( &mut self, __enum_dispatch_arg_0: ParkingSpot, __enum_dispatch_arg_1: CarID )

source§

fn remove_parked_car(&mut self, __enum_dispatch_arg_0: ParkedCar)

source§

fn add_parked_car(&mut self, __enum_dispatch_arg_0: ParkedCar)

source§

fn get_draw_cars( &self, __enum_dispatch_arg_0: LaneID, __enum_dispatch_arg_1: &Map ) -> Vec<DrawCarInput>

source§

fn get_draw_cars_in_lots( &self, __enum_dispatch_arg_0: LaneID, __enum_dispatch_arg_1: &Map ) -> Vec<DrawCarInput>

source§

fn get_draw_car( &self, __enum_dispatch_arg_0: CarID, __enum_dispatch_arg_1: &Map ) -> Option<DrawCarInput>

source§

fn get_all_draw_cars(&self, __enum_dispatch_arg_0: &Map) -> Vec<DrawCarInput>

source§

fn is_free(&self, __enum_dispatch_arg_0: ParkingSpot) -> bool

source§

fn get_car_at_spot( &self, __enum_dispatch_arg_0: ParkingSpot ) -> Option<&ParkedCar>

source§

fn spot_to_driving_pos( &self, __enum_dispatch_arg_0: ParkingSpot, __enum_dispatch_arg_1: &Vehicle, __enum_dispatch_arg_2: &Map ) -> Position

source§

fn spot_to_sidewalk_pos( &self, __enum_dispatch_arg_0: ParkingSpot, __enum_dispatch_arg_1: &Map ) -> Position

source§

fn get_owner_of_car(&self, __enum_dispatch_arg_0: CarID) -> Option<PersonID>

source§

fn lookup_parked_car(&self, __enum_dispatch_arg_0: CarID) -> Option<&ParkedCar>

source§

fn collect_events(&mut self) -> Vec<Event>

source§

fn all_parked_car_positions( &self, __enum_dispatch_arg_0: &Map ) -> Vec<(Position, PersonID)>

source§

fn bldg_to_parked_cars(&self, __enum_dispatch_arg_0: BuildingID) -> Vec<CarID>

source§

impl Serialize for ParkingSimState

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl TryInto<InfiniteParkingSimState> for ParkingSimState

§

type Error = &'static str

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

fn try_into( self ) -> Result<InfiniteParkingSimState, <Self as TryInto<InfiniteParkingSimState>>::Error>

Performs the conversion.
source§

impl TryInto<NormalParkingSimState> for ParkingSimState

§

type Error = &'static str

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

fn try_into( self ) -> Result<NormalParkingSimState, <Self as TryInto<NormalParkingSimState>>::Error>

Performs the conversion.

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
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

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

§

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

§

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

§

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

§

fn is_within(&self, b: &G2) -> bool

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,