File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88//! ## Usage
99//!
1010//! ```
11- //! use embedded_io::{self, Read, Write};
12- //! // optional async
13- //! use embedded_io_async;
11+ //! use embedded_io::{Read, Write};
1412//! use embedded_hal_mock::eh1::io::{Mock as IoMock, Transaction as IoTransaction};
1513//!
16- //!
17- //!
1814//! // Configure expectations
1915//! let expectations = [
2016//! IoTransaction::write(vec![10, 20]),
3733//! // Flushing
3834//! io.flush().unwrap();
3935//!
40- //! // Also async
36+ //! // Finalizing expectations
37+ //! io.done();
38+ //!
39+ //! // optional async
40+ //! #[cfg(feature = "embedded-hal-async")]
4141//! async {
42+ //! use embedded_io_async;
43+ //! let mut io = IoMock::new(&[IoTransaction::write(vec![10, 20])]);
4244//! let ret = embedded_io_async::Write::write(&mut io, &[10, 20]).await.unwrap();
45+ //! assert_eq!(ret, 2);
46+ //! io.done();
4347//! };
4448//!
45- //! // Finalizing expectations
46- //! io.done();
4749//! ```
4850
4951use embedded_io:: {
You can’t perform that action at this time.
0 commit comments