rustsim-transit 0.0.1

Public-transit primitives for rustsim: stops, routes, schedules, boarding/alighting queues, dwell times, headway control
Documentation
//! Public-transit primitives for rustsim.
//!
//! This crate provides the minimum set of types needed to model scheduled
//! shared-ride services (bus, tram, metro, rail, ferry, shuttle) sitting
//! above the generic `rustsim-traffic` link network. It is deliberately
//! agnostic to *how* a transit vehicle physically moves (that is
//! delegated to `rustsim-vehicle` or a custom controller) — it only
//! models the service layer.
//!
//! Core concepts:
//!
//! - [`Stop`] — a named point in space with a finite capacity for waiting
//!   passengers.
//! - [`Route`] — an ordered sequence of stops with a scheduled headway
//!   or explicit departure times.
//! - [`TransitVehicle`] — a service instance with a capacity and a list
//!   of current passenger IDs.
//! - [`Boarding`] — FIFO queue discipline at each stop.
//! - [`Schedule`] — either a fixed-headway or explicit-timetable
//!   departure pattern.
//! - [`dwell`] — a linear dwell-time model used to compute how long a
//!   vehicle sits at a stop.
//! - [`policy`] — explicit queue, dispatch, and dwell policy contracts.

#![deny(missing_docs)]

pub mod boarding;
pub mod dwell;
pub mod policy;
pub mod route;
pub mod schedule;
pub mod stop;
pub mod vehicle;

pub use boarding::{Boarding, BoardingResult, Waiter};
pub use dwell::{DwellParams, DwellTime};
pub use policy::{
    board_with_policy, BoardingPolicy, CapacityStopQueuePolicy, DispatchContext, DispatchDecision,
    DispatchPolicy, DwellPolicy, FifoBoardingPolicy, LinearDwellPolicy, ScheduledDispatchPolicy,
    StopQueuePolicy,
};
pub use route::{Route, RouteId};
pub use schedule::{Departure, Schedule};
pub use stop::{Stop, StopId};
pub use vehicle::{TransitVehicle, VehicleId};

/// Agent identifier — mirrors `rustsim_core::AgentId`.
pub type PassengerId = u64;

/// Convenience re-exports.
pub mod prelude {
    pub use crate::boarding::{Boarding, BoardingResult, Waiter};
    pub use crate::dwell::{DwellParams, DwellTime};
    pub use crate::policy::{
        board_with_policy, BoardingPolicy, CapacityStopQueuePolicy, DispatchContext,
        DispatchDecision, DispatchPolicy, DwellPolicy, FifoBoardingPolicy, LinearDwellPolicy,
        ScheduledDispatchPolicy, StopQueuePolicy,
    };
    pub use crate::route::{Route, RouteId};
    pub use crate::schedule::{Departure, Schedule};
    pub use crate::stop::{Stop, StopId};
    pub use crate::vehicle::{TransitVehicle, VehicleId};
    pub use crate::PassengerId;
}