msr_core/control/
mod.rs

1use crate::Measurement;
2
3pub mod cyclic;
4
5#[derive(Debug, Clone, PartialEq, Eq)]
6pub enum Value<V> {
7    Input(Input<V>),
8    Output(Output<V>),
9}
10
11impl<V> From<Output<V>> for Value<V> {
12    fn from(from: Output<V>) -> Self {
13        Self::Output(from)
14    }
15}
16
17impl<V> From<Input<V>> for Value<V> {
18    fn from(from: Input<V>) -> Self {
19        Self::Input(from)
20    }
21}
22
23#[derive(Debug, Clone, PartialEq, Eq)]
24pub struct Input<V> {
25    pub observed: Option<Measurement<V>>,
26}
27
28impl<V> Input<V> {
29    #[must_use]
30    pub const fn new() -> Self {
31        Self { observed: None }
32    }
33}
34
35impl<V> Default for Input<V> {
36    fn default() -> Self {
37        Self::new()
38    }
39}
40
41#[derive(Debug, Clone, PartialEq, Eq)]
42pub struct Output<V> {
43    pub observed: Option<Measurement<V>>,
44    pub desired: Option<Measurement<V>>,
45}
46
47impl<V> Output<V> {
48    #[must_use]
49    pub const fn new() -> Self {
50        Self {
51            observed: None,
52            desired: None,
53        }
54    }
55}
56
57impl<V> Default for Output<V> {
58    fn default() -> Self {
59        Self::new()
60    }
61}