Skip to main content

RiderBuilder

Struct RiderBuilder 

Source
pub struct RiderBuilder<'a> { /* private fields */ }
Expand description

Fluent builder for spawning riders with optional configuration.

Created via Simulation::build_rider.

use elevator_core::prelude::*;

let mut sim = SimulationBuilder::demo().build().unwrap();
let rider = sim.build_rider(StopId(0), StopId(1))
    .unwrap()
    .weight(80.0)
    .spawn()
    .unwrap();

Implementations§

Source§

impl RiderBuilder<'_>

Source

pub const fn weight(self, weight: f64) -> Self

Set the rider’s weight (default: 75.0).

Source

pub const fn group(self, group: GroupId) -> Self

Set the dispatch group explicitly, skipping auto-detection.

Source

pub fn route(self, route: Route) -> Self

Provide an explicit multi-leg route.

Source

pub const fn patience(self, max_wait_ticks: u64) -> Self

Set maximum wait ticks before the rider abandons.

Source

pub const fn preferences(self, prefs: Preferences) -> Self

Set boarding preferences.

Source

pub fn access_control(self, ac: AccessControl) -> Self

Set per-rider access control (allowed stops).

Source

pub fn spawn(self) -> Result<EntityId, SimError>

Spawn the rider with the configured options.

§Errors

Returns SimError::NoRoute if no group serves both stops (when auto-detecting). Returns SimError::AmbiguousRoute if multiple groups serve both stops (when auto-detecting). Returns SimError::GroupNotFound if an explicit group does not exist. Returns SimError::RouteOriginMismatch if an explicit route’s first leg does not start at origin.

Auto Trait Implementations§

§

impl<'a> Freeze for RiderBuilder<'a>

§

impl<'a> !RefUnwindSafe for RiderBuilder<'a>

§

impl<'a> Send for RiderBuilder<'a>

§

impl<'a> Sync for RiderBuilder<'a>

§

impl<'a> Unpin for RiderBuilder<'a>

§

impl<'a> UnsafeUnpin for RiderBuilder<'a>

§

impl<'a> !UnwindSafe for RiderBuilder<'a>

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.