Home 22. Enum's Debug
Post
Cancel

22. Enum's Debug

Use Debug trait to print enum values if needed.

1
2
3
4
5
6
7
8
9
10
#[derive(Default,Debug)]
enum Car{
    #[default]
    Porsche,
    Ferrari,
    Skoda
}

let car = Car::default();
println!("{:?}", car);
This post is licensed under CC BY 4.0 by the author.