dump
dump provides a macro dump!
that takes one or more variables and prints the name, type, and value of each variable. The output is also prefixed with [source_file:line_no]
.
This is designed to be a little more ergonomic than println!("a={:?} b={:?}", a, b)
and also has the benefit of printing the type.
Usage
Add this to your Cargo.toml
:
[]
= "0.1"
and this to your crate root:
extern crate dump;
Example
extern crate dump;
Outputs:
[src/main.rs:7] s: &'static str = "hi"; n: i32 = 3;