fix book tests
@@ -28,18 +28,27 @@ To our knowledge `derive(Format)` approach is more accurate in that it doesn't o
The different between the two approaches is depicted below:
``` rust
+# extern crate defmt;
+# use defmt::Format;
+
#[derive(Format)]
struct S<'a, T> {
x: Option<&'a T>,
y: u8,
}
+```
+
+``` rust
+# extern crate defmt;
+# use defmt::Format;
// `Format` produces this implementation
impl<'a, T> Format for S<'a, T>
where
- Option<&'a T>: Format
+ Option<&'a T>: Format // <- main difference
{
// ..
+ # fn format(&self, f: &mut defmt::Formatter) {}
}
#[derive(Debug)]
@@ -47,12 +56,21 @@ struct S<'a, T> {
x: Option<&'a T>,
y: u8,
}
+```
+
+``` rust
+# use std::fmt::Debug;
+# struct S<'a, T> {
+# x: Option<&'a T>,
+# y: u8,
+# }
// `Debug` produces this implementation
-impl<'a, T> Format for S<'a, T>
+impl<'a, T> Debug for S<'a, T>
where
- T: Format
+ T: Debug // <- main difference
{
// ..
+ # fn fmt(&self, f: &mut core::fmt::Formatter) -> std::fmt::Result { Ok(()) }
}
```
