Trait PrintAttribute

Source
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 Spans and empty tuples, are gracefully skipped so they don’t clutter the representation much.

Required Methods§

Source

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).

Source

fn print_attribute(&self, p: &mut Printer)

Implementations on Foreign Types§

Source§

impl PrintAttribute for AttrStyle

Source§

impl PrintAttribute for IntTy

Source§

impl PrintAttribute for UintTy

Source§

impl PrintAttribute for CommentKind

Source§

impl PrintAttribute for Transparency

Source§

impl PrintAttribute for bool

Source§

impl PrintAttribute for u16

Source§

impl PrintAttribute for ()

Source§

impl PrintAttribute for Align

Source§

impl PrintAttribute for Span

Source§

impl PrintAttribute for Symbol

Source§

impl PrintAttribute for NonZero<u32>

Source§

impl<A, B, C, D, E, F, G, H> PrintAttribute for (A, B, C, D, E, F, G, H)

Source§

impl<B, C, D, E, F, G, H> PrintAttribute for (B, C, D, E, F, G, H)

Source§

impl<C, D, E, F, G, H> PrintAttribute for (C, D, E, F, G, H)

Source§

impl<D, E, F, G, H> PrintAttribute for (D, E, F, G, H)

Source§

impl<E, F, G, H> PrintAttribute for (E, F, G, H)

Source§

impl<F, G, H> PrintAttribute for (F, G, H)

Source§

impl<G, H> PrintAttribute for (G, H)

Source§

impl<H> PrintAttribute for (H,)
where H: PrintAttribute,

Source§

impl<T> PrintAttribute for Option<T>
where T: PrintAttribute,

Source§

impl<T> PrintAttribute for &T
where T: PrintAttribute,

Source§

impl<T> PrintAttribute for ThinVec<T>
where T: PrintAttribute,

Implementors§