#[non_exhaustive]pub enum TrafficPattern {
Uniform,
UpPeak,
DownPeak,
Lunchtime,
Mixed,
}Expand description
Traffic pattern for generating realistic rider origin/destination distributions.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Uniform
Uniform random: equal probability for all origin/destination pairs.
UpPeak
Morning rush: most riders originate from the lobby (first stop) going up.
DownPeak
Evening rush: most riders head to the lobby (first stop) from upper stops.
Lunchtime
Lunch rush: riders go from upper stops to a mid-range stop and back.
Mixed
Mixed: combination of up-peak, down-peak, and inter-floor traffic.
Implementations§
Source§impl TrafficPattern
impl TrafficPattern
Sourcepub fn sample(
&self,
stops: &[EntityId],
rng: &mut impl RngExt,
) -> Option<(EntityId, EntityId)>
pub fn sample( &self, stops: &[EntityId], rng: &mut impl RngExt, ) -> Option<(EntityId, EntityId)>
Sample an (origin, destination) pair from the given stops.
stops must be sorted by position (lowest first). The first stop
is treated as the “lobby” for peak patterns.
Returns None if fewer than 2 stops are provided.
Trait Implementations§
Source§impl Clone for TrafficPattern
impl Clone for TrafficPattern
Source§fn clone(&self) -> TrafficPattern
fn clone(&self) -> TrafficPattern
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TrafficPattern
impl Debug for TrafficPattern
Source§impl<'de> Deserialize<'de> for TrafficPattern
impl<'de> Deserialize<'de> for TrafficPattern
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 PartialEq for TrafficPattern
impl PartialEq for TrafficPattern
Source§impl Serialize for TrafficPattern
impl Serialize for TrafficPattern
impl Copy for TrafficPattern
impl Eq for TrafficPattern
impl StructuralPartialEq for TrafficPattern
Auto Trait Implementations§
impl Freeze for TrafficPattern
impl RefUnwindSafe for TrafficPattern
impl Send for TrafficPattern
impl Sync for TrafficPattern
impl Unpin for TrafficPattern
impl UnsafeUnpin for TrafficPattern
impl UnwindSafe for TrafficPattern
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