Function robust_arduino_serial::read_order [] [src]

pub fn read_order<T: Read>(file: &mut T) -> Result<Option<Order>, Error>

Read one byte from a file/serial port and convert it to an order

Example

use std::io::Cursor;
use robust_arduino_serial::*;

let mut buffer = Cursor::new(vec![2]);
let order = read_order(&mut buffer).unwrap().unwrap();
// Order::MOTOR has the index 2 in the enum
assert_eq!(Order::MOTOR, order);