[][src]Struct msr::IoState

pub struct IoState {
    pub inputs: HashMap<String, Value>,
    pub outputs: HashMap<String, Value>,
    pub mem: HashMap<String, Value>,
}

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]

impl PartialEq<IoState> for IoState[src]

impl Clone for 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

impl Send for IoState

impl Sync for IoState

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]