Struct rustc_ap_rustc_ast_pretty::pprust::state::State [−][src]
pub struct State<'a> { pub s: Printer, // some fields omitted }
Fields
s: Printer
Implementations
Methods from Deref<Target = Printer>
Be very careful with this!
Trait Implementations
fn strsep<T, F>(
&mut self,
sep: &'static str,
space_before: bool,
b: Breaks,
elts: &[T],
op: F
) where
F: FnMut(&mut Self, &T),
fn print_either_attributes(
&mut self,
attrs: &[Attribute],
kind: AttrStyle,
is_inline: bool,
trailing_hardbreak: bool
)
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
fn print_mac_common(
&mut self,
header: Option<MacHeader<'_>>,
has_bang: bool,
ident: Option<Ident>,
delim: DelimToken,
tts: &TokenStream,
convert_dollar_crate: bool,
span: Span
)
Print the token kind precisely, without converting $crate
into its respective crate name.
fn token_kind_to_string_ext(
&self,
tok: &TokenKind,
convert_dollar_crate: Option<Span>
) -> String
Print the token precisely, without converting $crate
into its respective crate name.
Auto Trait Implementations
impl<'a> !RefUnwindSafe for State<'a>
impl<'a> !UnwindSafe for State<'a>