[−][src]Struct msr::IoState
The state of all inputs and outputs of a MSR system.
Example
use msr::*; use std::{thread, time::Duration}; let mut state = IoState::default(); loop { // Read some inputs (you'd use s.th. like 'read("sensor_id")') let sensor_value = Value::Decimal(8.9); state.inputs.insert("tcr001".into(), sensor_value); // Calculate some outputs (you'd use s.th. like 'calc(&state)') let actuator_value = Value::Decimal(1.7); state.outputs.insert("h1".into(), actuator_value); // Wait for next cycle thread::sleep(Duration::from_secs(2)); }
Fields
inputs: HashMap<String, Value>
Input gates (sensors)
outputs: HashMap<String, Value>
Output gates (actuators)
mem: HashMap<String, Value>
Values that only live in memory
Trait Implementations
impl SyncIoSystem for IoState
[src]
fn read(&mut self, id: &str) -> Result<Value>
[src]
fn read_output(&mut self, id: &str) -> Result<Option<Value>>
[src]
fn write(&mut self, id: &str, v: &Value) -> Result<()>
[src]
impl PartialEq<IoState> for IoState
[src]
impl Clone for IoState
[src]
fn clone(&self) -> IoState
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Default for IoState
[src]
impl Debug for IoState
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,