<ao> | Adetunji's Blog

Give enum and struct the ability to be formatted

The message with #[] are called attributes and will instruct the compiler to give you enum or struct a certain ability like Debug with which you can print it with {:?}

` #[derive(Debug)]

derive is the most popular one.

#[derive(Debug)]
enum Animal{
  Cat,
  Dog,
}

Now, we can do:

println!("{:?}", Animal::Cat)

#note #rust