Objectives
- Implement the
CustomDebugderive to output the fields of a struct in a custom way.- The
CustomDebugderive will implement theDebugtrait for the struct. - Use
syn::DeriveInputto 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
CustomDebugoutput.- 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)
quoteCrate DocumentationsynCrate Documentation (specificallyDeriveInput,Field)