pub struct State<'a> {
    pub s: Printer,
    comments: Option<Comments<'a>>,
    ann: &'a (dyn PpAnn + 'a),
}

Fields§

§s: Printer§comments: Option<Comments<'a>>§ann: &'a (dyn PpAnn + 'a)

Implementations§

source

fn print_call_post(&mut self, args: &[P<Expr>])

Prints an expr using syntax that’s acceptable in a condition position, such as the cond in if cond { ... }.

Does expr need parentheses when printed in a condition position?

These cases need parens due to the parse error observed in #26461: if return {} parses as the erroneous construct if (return {}), not if (return) {}.

Prints expr or (expr) when needs_par holds.

Pretty-prints an item.

Print a let pat = expr expression.

Methods from Deref<Target = Printer>§

Synthesizes a comment that was not textually present in the original source file.

“raw box”

Inconsistent breaking box

Consistent breaking box

Be very careful with this!

Trait Implementations§

The resulting type after dereferencing.
Dereferences the value.
Mutably dereferences the value.
This doesn’t deserve to be called “pretty” printing, but it should be meaning-preserving. A quick hack that might help would be to look at the spans embedded in the TTs to decide where to put spaces and newlines. But it’d be better to parse these according to the grammar of the appropriate macro, transcribe back into the grammar we just parsed from, and then pretty-print the resulting AST nodes (so, e.g., we print expression arguments as expressions). It can be done! I think. Read more
Print the token kind precisely, without converting $crate into its respective crate name.
Print the token precisely, without converting $crate into its respective crate name.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.

Size: 248 bytes