| 1 | //! Implementation of `core::fmt::Write` for the HAL's `serial::Write`. |
|---|---|
| 2 | //! |
| 3 | //! TODO write example of usage |
| 4 | use core::fmt::{Result, Write}; |
| 5 | |
| 6 | impl<Word, Error> Write for dyn (::serial::Write<Word, Error = Error>) |
| 7 | where |
| 8 | Word: From<u8>, |
| 9 | { |
| 10 | fn write_str(&mut self, s: &str) -> Result { |
| 11 | let _ = simpl Iterator |
| 12 | .as_bytes() |
| 13 | .into_iter() |
| 14 | .map(|c: &u8| block!(self.write(Word::from(*c)))) |
| 15 | .last(); |
| 16 | Ok(()) |
| 17 | } |
| 18 | } |
| 19 |
