Crates.io | dump |
lib.rs | dump |
version | 0.1.1 |
source | src |
created_at | 2016-02-18 00:02:41.453208 |
updated_at | 2016-02-18 00:17:01.749154 |
description | A simple macro 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]. |
homepage | https://github.com/ludios/dump |
repository | https://github.com/ludios/dump |
max_upload_size | |
id | 4201 |
size | 13,716 |
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.
Add this to your Cargo.toml
:
[dependencies]
dump = "0.1"
and this to your crate root:
#[macro_use]
extern crate dump;
#[macro_use]
extern crate dump;
fn main() {
let s = "hi";
let n = 3;
dump!(s, n);
}
Outputs:
[src/main.rs:7] s: &'static str = "hi"; n: i32 = 3;