Document Format derive attr in book
@@ -79,5 +79,22 @@ If you quickly want to get some code running and do not care about it being effi
Note that this always uses `{:?}` to format the contained value, meaning that any provided defmt display hints will be ignored.
+When using `#[derive(Format)]` you may use the `#[defmt()]` attribute on specific fields to use these adapter types.
+Example below:
+
+``` rust
+#[derive(Format)]
+enum Error {
+ Serde(#[defmt(Debug2Format)] serde_json::Error),
+ ResponseTooLarge,
+}
+
+#[derive(Format)]
+struct Reading {
+ #[defmt(Display2Format)]
+ temperature: Celsius,
+}
+```
+
[`Display2Format`]: https://docs.rs/defmt/*/defmt/struct.Display2Format.html
[`Debug2Format`]: https://docs.rs/defmt/*/defmt/struct.Debug2Format.html
