Objectives
- Implement the
CustomDebug
derive to output the fields of a struct in a custom way.- The
CustomDebug
derive will implement theDebug
trait for the struct. - Use
syn::DeriveInput
to get the fields of the struct. - Iterate over each field and output the field in a nice way.
- The
- Extra: Use custom attributes to affect your
CustomDebug
output.- Only output fields that are tagged with the
#[debug]
attribute.
- Only output fields that are tagged with the
Helpful Documentation
- Procedural Macros & Custom Derive (Rust Book)
quote
Crate Documentationsyn
Crate Documentation (specificallyDeriveInput
,Field
)