tudelft-xray-sim 1.0.0

simulation library for the modeling assignment in the course 'Software Systems' at the TU Delft.
Documentation
use std::fmt::Debug;
use std::ops::IndexMut;

#[allow(missing_docs)]
/// Enum to represent the 3 pedals present in a one-plane system.
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
pub enum ThreePedals {
    Pedal1,
    Pedal2,
    Pedal3,
}

#[allow(missing_docs)]
/// Enum to represent the 6 pedals in a two-plane system.
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
pub enum SixPedals {
    Pedal1,
    Pedal2,
    Pedal3,
    Pedal4,
    Pedal5,
    Pedal6,
}

pub(crate) trait Pedals: Sized + Copy + Debug {
    type STATES: Default + IndexMut<usize, Output = bool>;
    fn variants<'a>() -> &'a [Self];
}

impl Pedals for ThreePedals {
    type STATES = [bool; 3];
    fn variants<'a>() -> &'a [Self] {
        use ThreePedals::*;
        &[Pedal1, Pedal2, Pedal3]
    }
}

impl Pedals for SixPedals {
    type STATES = [bool; 6];
    fn variants<'a>() -> &'a [Self] {
        use SixPedals::*;
        &[Pedal1, Pedal2, Pedal3, Pedal4, Pedal5, Pedal6]
    }
}