Expand description
§serde -> std::fmt
This library lets you take any Serialize and format it as if it’s Debug.
The format produced is the same as if the type derived Debug, and any
formatting flags will be preserved.
§Getting started
Add serde_fmt to your Cargo.toml:
[dependencies.serde_fmt]
version = "1.1.0"By default, this library doesn’t depend on the standard library.
You can enable support with the std Cargo feature:
[dependencies.serde_fmt]
version = "1.1.0"
features = ["std"]§Formatting a Serialize
Use the to_debug function to treat a serde_core::Serialize like a std::fmt::Debug:
fn takes_serialize(v: impl Serialize) {
// You can dump any `Serialize` using the
// standard `dbg!` macro
dbg!(serde_fmt::to_debug(&v));
// do something with `v`
}Structs§
Functions§
- to_
debug - Treat a type implementing
serde_core::Serializelike a type implementingstd::fmt::Debug. - to_
writer - Format a
serde_core::Serializeinto astd::fmt::Write.