We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents f2a36d1 + d14d6cd commit dd92c3aCopy full SHA for dd92c3a
src/fmt.rs
@@ -0,0 +1,17 @@
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 ::serial::Write<Word, Error=Error>
7
+where
8
+ Word: From<u8>,
9
+{
10
+ fn write_str(&mut self, s: &str) -> Result {
11
+ let _ = s.as_bytes()
12
+ .into_iter()
13
+ .map(|c| block!(self.write(Word::from(*c))))
14
+ .last();
15
+ Ok(())
16
+ }
17
+}
src/lib.rs
@@ -693,6 +693,7 @@ extern crate void;
693
pub mod adc;
694
pub mod blocking;
695
pub mod digital;
696
+pub mod fmt;
697
pub mod prelude;
698
pub mod serial;
699
pub mod spi;
0 commit comments