1use rustsim_geometry::vec3::Vec3;
4
5pub type StopId = u64;
7
8#[derive(Debug, Clone)]
10pub struct Stop {
11 pub id: StopId,
13 pub name: String,
15 pub pos: Vec3,
17 pub capacity: u32,
19}
20
21impl Stop {
22 pub fn at_ground(id: StopId, name: impl Into<String>, x: f64, y: f64, capacity: u32) -> Self {
24 Self {
25 id,
26 name: name.into(),
27 pos: [x, y, 0.0],
28 capacity,
29 }
30 }
31}
32
33#[cfg(test)]
34mod tests {
35 use super::*;
36
37 #[test]
38 fn construct_at_ground() {
39 let s = Stop::at_ground(1, "Main St & 3rd", 10.0, 20.0, 120);
40 assert_eq!(s.id, 1);
41 assert_eq!(s.pos, [10.0, 20.0, 0.0]);
42 assert_eq!(s.capacity, 120);
43 }
44}