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§

fn should_render(&self) -> bool

Source§

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

Source§

impl PrintAttribute for IntTy

Source§

fn should_render(&self) -> bool

Source§

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

Source§

impl PrintAttribute for UintTy

Source§

fn should_render(&self) -> bool

Source§

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

Source§

impl PrintAttribute for CommentKind

Source§

fn should_render(&self) -> bool

Source§

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

Source§

impl PrintAttribute for Transparency

Source§

fn should_render(&self) -> bool

Source§

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

Source§

impl PrintAttribute for bool

Source§

fn should_render(&self) -> bool

Source§

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

Source§

impl PrintAttribute for u16

Source§

fn should_render(&self) -> bool

Source§

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

Source§

impl PrintAttribute for ()

Source§

fn should_render(&self) -> bool

Source§

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

Source§

impl PrintAttribute for NonZero<u32>

Source§

fn should_render(&self) -> bool

Source§

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

Source§

impl PrintAttribute for Span

Source§

fn should_render(&self) -> bool

Source§

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

Source§

impl PrintAttribute for Symbol

Source§

fn should_render(&self) -> bool

Source§

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

Source§

impl PrintAttribute for Align

Source§

fn should_render(&self) -> bool

Source§

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

Source§

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

Source§

fn should_render(&self) -> bool

Source§

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

Source§

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

Source§

fn should_render(&self) -> bool

Source§

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

Source§

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

Source§

fn should_render(&self) -> bool

Source§

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

Source§

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

Source§

fn should_render(&self) -> bool

Source§

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

Source§

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

Source§

fn should_render(&self) -> bool

Source§

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

Source§

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

Source§

fn should_render(&self) -> bool

Source§

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

Source§

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

Source§

fn should_render(&self) -> bool

Source§

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

Source§

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

Source§

fn should_render(&self) -> bool

Source§

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

Source§

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

Source§

fn should_render(&self) -> bool

Source§

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

Source§

impl<T: PrintAttribute> PrintAttribute for &T

Source§

fn should_render(&self) -> bool

Source§

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

Source§

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

Source§

fn should_render(&self) -> bool

Source§

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

Implementors§