Rust tips is a user on octodon.social. You can follow them or interact with them if you have an account anywhere in the fediverse. If you don't, you can sign up here.
Rust tips @rust

debug print format `{:?}` prints the whole expression in one line.

There's a pretty-print `{:#?}` which prints structs and vectors in a nice multi-line indented format.

println!("{:#?}", complex_value);

If you're implementing Debug trait for your types manually, check out Formatter methods to support pretty-printing:

doc.rust-lang.org/std/fmt/stru

· Web · 5 · 4