Skip to content
Brooks Patton edited this page Aug 17, 2018 · 2 revisions

Printing Values

Debug

#[derive(Debug)] Adding the ability to print with println! macro on data structures like enums, HashMaps, and Vectors.

trait debug documentation

Example

#[derive(Debug)]
enum Command {
    Add {name: String, department: String},
    Get,
    GetByDepartment(String),
}

Now we can print with println!

println!("{:?}", our_enum);

Printing to standard out

eprintln!("this will go to standard out");

documentation

Clone this wiki locally