Struct sim::mechanics::parking::InfiniteParkingSimState

source ·
pub struct InfiniteParkingSimState {
    parked_cars: BTreeMap<CarID, ParkedCar>,
    occupants: BTreeMap<ParkingSpot, CarID>,
    reserved_spots: BTreeMap<ParkingSpot, CarID>,
    driving_to_offstreet: MultiMap<LaneID, (BuildingID, Distance)>,
    blackholed_building_redirects: BTreeMap<BuildingID, BuildingID>,
    num_occupants_per_offstreet: BTreeMap<BuildingID, usize>,
    events: Vec<Event>,
}
Expand description

This assigns infinite private parking to all buildings and none anywhere else. This effectively disables the simulation of parking entirely, making driving trips just go directly between buildings. Useful for maps without good parking data (which is currently all of them) and experiments where parking contention skews results and just gets in the way.

Fields§

§parked_cars: BTreeMap<CarID, ParkedCar>§occupants: BTreeMap<ParkingSpot, CarID>§reserved_spots: BTreeMap<ParkingSpot, CarID>§driving_to_offstreet: MultiMap<LaneID, (BuildingID, Distance)>§blackholed_building_redirects: BTreeMap<BuildingID, BuildingID>§num_occupants_per_offstreet: BTreeMap<BuildingID, usize>§events: Vec<Event>

Implementations§

Trait Implementations§

source§

impl Clone for InfiniteParkingSimState

source§

fn clone(&self) -> InfiniteParkingSimState

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 InfiniteParkingSimState

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 ParkingSim for InfiniteParkingSimState

source§

fn handle_live_edits( &mut self, map: &Map, _: &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 get_free_onstreet_spots(&self, _: LaneID) -> Vec<ParkingSpot>

source§

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

source§

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

source§

fn reserve_spot(&mut self, spot: ParkingSpot, car: CarID)

source§

fn unreserve_spot(&mut self, car: CarID)

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

fn remove_parked_car(&mut self, p: ParkedCar)

source§

fn add_parked_car(&mut self, p: ParkedCar)

source§

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

source§

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

source§

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

source§

fn canonical_pt(&self, id: CarID, map: &Map) -> Option<Pt2D>

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

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

source§

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

source§

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

source§

fn get_all_free_spots( &self, driving_pos: Position, vehicle: &Vehicle, target: BuildingID, map: &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 spot_to_driving_pos( &self, spot: ParkingSpot, _: &Vehicle, map: &Map ) -> Position

source§

fn spot_to_sidewalk_pos(&self, spot: ParkingSpot, map: &Map) -> Position

source§

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

source§

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

source§

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

(Filled, available)
source§

fn path_to_free_parking_spot( &self, start: LaneID, vehicle: &Vehicle, target: BuildingID, map: &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 collect_events(&mut self) -> Vec<Event>

source§

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

source§

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

source§

impl Serialize for InfiniteParkingSimState

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.

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