pub trait PrintAttribute {
// Required methods
fn should_render(&self) -> bool;
fn print_attribute(&self, p: &mut Printer);
}
Expand description
This trait is used to print attributes in rustc_hir_pretty
.
For structs and enums it can be derived using rustc_macros::PrintAttribute
.
The output will look a lot like a Debug
implementation, but fields of several types
like Span
s and empty tuples, are gracefully skipped so they don’t clutter the
representation much.
Required Methods§
Sourcefn should_render(&self) -> bool
fn should_render(&self) -> bool
Whether or not this will render as something meaningful, or if it’s skipped (which will force the containing struct to also skip printing a comma and the field name).