rustsim_transit/lib.rs
1//! Public-transit primitives for rustsim.
2//!
3//! This crate provides the minimum set of types needed to model scheduled
4//! shared-ride services (bus, tram, metro, rail, ferry, shuttle) sitting
5//! above the generic `rustsim-traffic` link network. It is deliberately
6//! agnostic to *how* a transit vehicle physically moves (that is
7//! delegated to `rustsim-vehicle` or a custom controller) — it only
8//! models the service layer.
9//!
10//! Core concepts:
11//!
12//! - [`Stop`] — a named point in space with a finite capacity for waiting
13//! passengers.
14//! - [`Route`] — an ordered sequence of stops with a scheduled headway
15//! or explicit departure times.
16//! - [`TransitVehicle`] — a service instance with a capacity and a list
17//! of current passenger IDs.
18//! - [`Boarding`] — FIFO queue discipline at each stop.
19//! - [`Schedule`] — either a fixed-headway or explicit-timetable
20//! departure pattern.
21//! - [`dwell`] — a linear dwell-time model used to compute how long a
22//! vehicle sits at a stop.
23//! - [`policy`] — explicit queue, dispatch, and dwell policy contracts.
24
25#![deny(missing_docs)]
26
27pub mod boarding;
28pub mod dwell;
29pub mod policy;
30pub mod route;
31pub mod schedule;
32pub mod stop;
33pub mod vehicle;
34
35pub use boarding::{Boarding, BoardingResult, Waiter};
36pub use dwell::{DwellParams, DwellTime};
37pub use policy::{
38 board_with_policy, BoardingPolicy, CapacityStopQueuePolicy, DispatchContext, DispatchDecision,
39 DispatchPolicy, DwellPolicy, FifoBoardingPolicy, LinearDwellPolicy, ScheduledDispatchPolicy,
40 StopQueuePolicy,
41};
42pub use route::{Route, RouteId};
43pub use schedule::{Departure, Schedule};
44pub use stop::{Stop, StopId};
45pub use vehicle::{TransitVehicle, VehicleId};
46
47/// Agent identifier — mirrors `rustsim_core::AgentId`.
48pub type PassengerId = u64;
49
50/// Convenience re-exports.
51pub mod prelude {
52 pub use crate::boarding::{Boarding, BoardingResult, Waiter};
53 pub use crate::dwell::{DwellParams, DwellTime};
54 pub use crate::policy::{
55 board_with_policy, BoardingPolicy, CapacityStopQueuePolicy, DispatchContext,
56 DispatchDecision, DispatchPolicy, DwellPolicy, FifoBoardingPolicy, LinearDwellPolicy,
57 ScheduledDispatchPolicy, StopQueuePolicy,
58 };
59 pub use crate::route::{Route, RouteId};
60 pub use crate::schedule::{Departure, Schedule};
61 pub use crate::stop::{Stop, StopId};
62 pub use crate::vehicle::{TransitVehicle, VehicleId};
63 pub use crate::PassengerId;
64}