tudelft_xray_sim/lib.rs
1#![warn(missing_docs)]
2#![allow(clippy::needless_doctest_main)]
3//! Simulation library for the modeling assignment in the course 'Software Systems' at the TU Delft.
4//!
5//! The expected way to interact with this library is to implement the [`PedalMapper`] and [`ActionLogic`]
6//! traits and then use either [`run_single_plane_sim`] or [`run_double_plane_sim`] from your `main` function.
7//! A GUI will appear with a checkbox for each pedal, and a display for each of the available planes.
8//!
9//! Depending on the implementation of the two traits mentioned above, pressing each pedal
10//! will modify the state of the planes. All interaction is logged, as well as any potential
11//! warnings or errors caused by improper commands.
12//!
13//! Here is the absolute minimum you have to do to get the simulation to run:
14//!
15//! ```no_run
16//! use tudelft_xray_sim::*;
17//!
18//! fn main() {
19//! run_single_plane_sim(Logic);
20//! }
21//!
22//! struct Logic;
23//!
24//! impl PedalMapper for Logic {
25//! type Pedals = ThreePedals;
26//! fn on_press(&self, pedal: Self::Pedals) -> Option<Request> { None }
27//! fn on_release(&self, pedal: Self::Pedals) -> Option<Request> { None }
28//! }
29//!
30//! impl ActionLogic<false> for Logic {
31//! fn handle_request(&mut self, request: Request, controller: &mut Controller<false>) {}
32//! }
33//! ```
34//!
35//! Logging is done with [log], so any logger which supports it will work.
36//! For example you can use [simple_logger](https://docs.rs/simple_logger/)
37//! to print everything to the standard output (default configuration).
38//!
39//! ```ignore
40//! fn main() {
41//! simple_logger::init().unwrap();
42//! // ...
43//! }
44//! ```
45
46mod controller;
47mod dose;
48mod mode;
49mod pedals;
50mod plane;
51mod projection;
52mod request;
53mod run;
54mod traits;
55
56pub use controller::*;
57pub use dose::*;
58pub use mode::*;
59pub use pedals::*;
60pub use plane::*;
61pub use projection::*;
62pub use request::*;
63pub use run::*;
64pub use traits::*;