use rustsim_geometry::vec3::Vec3;
pub type StopId = u64;
#[derive(Debug, Clone)]
pub struct Stop {
pub id: StopId,
pub name: String,
pub pos: Vec3,
pub capacity: u32,
}
impl Stop {
pub fn at_ground(id: StopId, name: impl Into<String>, x: f64, y: f64, capacity: u32) -> Self {
Self {
id,
name: name.into(),
pos: [x, y, 0.0],
capacity,
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn construct_at_ground() {
let s = Stop::at_ground(1, "Main St & 3rd", 10.0, 20.0, 120);
assert_eq!(s.id, 1);
assert_eq!(s.pos, [10.0, 20.0, 0.0]);
assert_eq!(s.capacity, 120);
}
}