traci_rs/lib.rs
1// SPDX-License-Identifier: EPL-2.0
2//! # traci-rs
3//!
4//! A pure-Rust client library for the [SUMO](https://sumo.dlr.de) TraCI
5//! (Traffic Control Interface) protocol.
6//!
7//! ## Quick start
8//!
9//! ```no_run
10//! use traci_rs::TraciClient;
11//!
12//! fn main() -> Result<(), traci_rs::TraciError> {
13//! let mut client = TraciClient::connect("127.0.0.1", 8813)?;
14//! client.set_order(1)?;
15//!
16//! // Advance the simulation one step
17//! client.simulation_step(0.0)?;
18//!
19//! // Query all vehicles
20//! let ids = client.vehicle.get_id_list(&mut client)?;
21//! for id in &ids {
22//! let pos = client.vehicle.get_position(&mut client, id)?;
23//! println!("{}: ({}, {})", id, pos.x, pos.y);
24//! }
25//!
26//! client.close()?;
27//! Ok(())
28//! }
29//! ```
30
31#[macro_use]
32pub(crate) mod scopes;
33
34pub mod constants;
35pub mod error;
36pub mod storage;
37pub mod socket;
38pub mod types;
39pub mod client;
40
41pub use client::TraciClient;
42pub use error::TraciError;
43pub use types::*;
44pub use types::SubscribedKinematics;
45
46// Re-export scope types so users can name them in generic helpers.
47pub use scopes::vehicle::VehicleScope;
48pub use scopes::person::PersonScope;
49pub use scopes::simulation::SimulationScope;
50pub use scopes::traffic_light::TrafficLightScope;
51pub use scopes::vehicle_type::VehicleTypeScope;
52pub use scopes::edge::EdgeScope;
53pub use scopes::lane::LaneScope;
54pub use scopes::junction::JunctionScope;
55pub use scopes::route::RouteScope;