October 2019
Intermediate to advanced
444 pages
10h 37m
English
You can use I/O loops to read things efficiently in a few steps:
use std::io;use rand::prelude::*;type Result<T> = std::result::Result<T, io::Error>;pub trait Thermometer { fn temp_celsius(&mut self) -> Result<f32>;}enum Register { Calib0 = 0x00, Data = 0x01,}
#[allow(dead_code)]pub struct RawI2CDeviceMock { path: String, device_id: u8,}impl RawI2CDeviceMock { pub fn new(path: String, device_id: u8) -> RawI2CDeviceMock { RawI2CDeviceMock ...Read now
Unlock full access