Trait rustc_ap_rustc_ast_pretty::pprust::state::PrintState [−][src]
pub trait PrintState<'a>: Deref<Target = Printer> + DerefMut {}Show methods
fn comments(&mut self) -> &mut Option<Comments<'a>>; fn print_ident(&mut self, ident: Ident); fn print_generic_args(
&mut self,
args: &GenericArgs,
colons_before_params: bool
); 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 commasep<T, F>(&mut self, b: Breaks, elts: &[T], op: F)
where
F: FnMut(&mut Self, &T), { ... } fn maybe_print_comment(&mut self, pos: BytePos) { ... } fn print_comment(&mut self, cmnt: &Comment) { ... } fn next_comment(&mut self) -> Option<Comment> { ... } fn print_literal(&mut self, lit: &Lit) { ... } fn print_string(&mut self, st: &str, style: StrStyle) { ... } fn print_symbol(&mut self, sym: Symbol, style: StrStyle) { ... } fn print_inner_attributes(&mut self, attrs: &[Attribute]) { ... } fn print_outer_attributes(&mut self, attrs: &[Attribute]) { ... } fn print_inner_attributes_inline(&mut self, attrs: &[Attribute]) { ... } fn print_outer_attributes_inline(&mut self, attrs: &[Attribute]) { ... } fn print_either_attributes(
&mut self,
attrs: &[Attribute],
kind: AttrStyle,
is_inline: bool,
trailing_hardbreak: bool
) { ... } fn print_attribute(&mut self, attr: &Attribute) { ... } fn print_attribute_inline(&mut self, attr: &Attribute, is_inline: bool) { ... } fn print_attr_item(&mut self, item: &AttrItem, span: Span) { ... } fn print_meta_list_item(&mut self, item: &NestedMetaItem) { ... } fn print_meta_item(&mut self, item: &MetaItem) { ... } fn print_tt(&mut self, tt: &TokenTree, convert_dollar_crate: bool) { ... } fn print_tts(&mut self, tts: &TokenStream, convert_dollar_crate: bool) { ... } 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
) { ... } fn print_path(
&mut self,
path: &Path,
colons_before_params: bool,
depth: usize
) { ... } fn print_path_segment(
&mut self,
segment: &PathSegment,
colons_before_params: bool
) { ... } fn head<S: Into<Cow<'static, str>>>(&mut self, w: S) { ... } fn bopen(&mut self) { ... } fn bclose_maybe_open(&mut self, span: Span, close_box: bool) { ... } fn bclose(&mut self, span: Span) { ... } fn break_offset_if_not_bol(&mut self, n: usize, off: isize) { ... } fn nonterminal_to_string(&self, nt: &Nonterminal) -> String { ... } fn token_kind_to_string(&self, tok: &TokenKind) -> String { ... } fn token_kind_to_string_ext(
&self,
tok: &TokenKind,
convert_dollar_crate: Option<Span>
) -> String { ... } fn token_to_string(&self, token: &Token) -> String { ... } fn token_to_string_ext(
&self,
token: &Token,
convert_dollar_crate: bool
) -> String { ... } fn ty_to_string(&self, ty: &Ty) -> String { ... } fn bounds_to_string(&self, bounds: &[GenericBound]) -> String { ... } fn pat_to_string(&self, pat: &Pat) -> String { ... } fn expr_to_string(&self, e: &Expr) -> String { ... } fn tt_to_string(&self, tt: &TokenTree) -> String { ... } fn tts_to_string(&self, tokens: &TokenStream) -> String { ... } fn stmt_to_string(&self, stmt: &Stmt) -> String { ... } fn item_to_string(&self, i: &Item) -> String { ... } fn generic_params_to_string(
&self,
generic_params: &[GenericParam]
) -> String { ... } fn path_to_string(&self, p: &Path) -> String { ... } fn path_segment_to_string(&self, p: &PathSegment) -> String { ... } fn vis_to_string(&self, v: &Visibility) -> String { ... } fn block_to_string(&self, blk: &Block) -> String { ... } fn meta_list_item_to_string(&self, li: &NestedMetaItem) -> String { ... } fn attr_item_to_string(&self, ai: &AttrItem) -> String { ... } fn attribute_to_string(&self, attr: &Attribute) -> String { ... } fn param_to_string(&self, arg: &Param) -> String { ... } fn to_string(&self, f: impl FnOnce(&mut State<'_>)) -> String { ... }
Required methods
fn comments(&mut self) -> &mut Option<Comments<'a>>
[src]
fn print_ident(&mut self, ident: Ident)
[src]
fn print_generic_args(&mut self, args: &GenericArgs, colons_before_params: bool)
[src]
Provided methods
fn strsep<T, F>(
&mut self,
sep: &'static str,
space_before: bool,
b: Breaks,
elts: &[T],
op: F
) where
F: FnMut(&mut Self, &T),
[src]
&mut self,
sep: &'static str,
space_before: bool,
b: Breaks,
elts: &[T],
op: F
) where
F: FnMut(&mut Self, &T),
fn commasep<T, F>(&mut self, b: Breaks, elts: &[T], op: F) where
F: FnMut(&mut Self, &T),
[src]
F: FnMut(&mut Self, &T),
fn maybe_print_comment(&mut self, pos: BytePos)
[src]
fn print_comment(&mut self, cmnt: &Comment)
[src]
fn next_comment(&mut self) -> Option<Comment>
[src]
fn print_literal(&mut self, lit: &Lit)
[src]
fn print_string(&mut self, st: &str, style: StrStyle)
[src]
fn print_symbol(&mut self, sym: Symbol, style: StrStyle)
[src]
fn print_inner_attributes(&mut self, attrs: &[Attribute])
[src]
fn print_outer_attributes(&mut self, attrs: &[Attribute])
[src]
fn print_inner_attributes_inline(&mut self, attrs: &[Attribute])
[src]
fn print_outer_attributes_inline(&mut self, attrs: &[Attribute])
[src]
fn print_either_attributes(
&mut self,
attrs: &[Attribute],
kind: AttrStyle,
is_inline: bool,
trailing_hardbreak: bool
)
[src]
&mut self,
attrs: &[Attribute],
kind: AttrStyle,
is_inline: bool,
trailing_hardbreak: bool
)
fn print_attribute(&mut self, attr: &Attribute)
[src]
fn print_attribute_inline(&mut self, attr: &Attribute, is_inline: bool)
[src]
fn print_attr_item(&mut self, item: &AttrItem, span: Span)
[src]
fn print_meta_list_item(&mut self, item: &NestedMetaItem)
[src]
fn print_meta_item(&mut self, item: &MetaItem)
[src]
fn print_tt(&mut self, tt: &TokenTree, convert_dollar_crate: bool)
[src]
fn print_tt(&mut self, tt: &TokenTree, convert_dollar_crate: bool)
[src]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.
fn print_tts(&mut self, tts: &TokenStream, convert_dollar_crate: bool)
[src]
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
)
[src]
&mut self,
header: Option<MacHeader<'_>>,
has_bang: bool,
ident: Option<Ident>,
delim: DelimToken,
tts: &TokenStream,
convert_dollar_crate: bool,
span: Span
)
fn print_path(&mut self, path: &Path, colons_before_params: bool, depth: usize)
[src]
fn print_path_segment(
&mut self,
segment: &PathSegment,
colons_before_params: bool
)
[src]
&mut self,
segment: &PathSegment,
colons_before_params: bool
)
fn head<S: Into<Cow<'static, str>>>(&mut self, w: S)
[src]
fn bopen(&mut self)
[src]
fn bclose_maybe_open(&mut self, span: Span, close_box: bool)
[src]
fn bclose(&mut self, span: Span)
[src]
fn break_offset_if_not_bol(&mut self, n: usize, off: isize)
[src]
fn nonterminal_to_string(&self, nt: &Nonterminal) -> String
[src]
fn token_kind_to_string(&self, tok: &TokenKind) -> String
[src]
fn token_kind_to_string(&self, tok: &TokenKind) -> String
[src]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
[src]
&self,
tok: &TokenKind,
convert_dollar_crate: Option<Span>
) -> String
fn token_to_string(&self, token: &Token) -> String
[src]
fn token_to_string(&self, token: &Token) -> String
[src]Print the token precisely, without converting $crate
into its respective crate name.
fn token_to_string_ext(
&self,
token: &Token,
convert_dollar_crate: bool
) -> String
[src]
&self,
token: &Token,
convert_dollar_crate: bool
) -> String
fn ty_to_string(&self, ty: &Ty) -> String
[src]
fn bounds_to_string(&self, bounds: &[GenericBound]) -> String
[src]
fn pat_to_string(&self, pat: &Pat) -> String
[src]
fn expr_to_string(&self, e: &Expr) -> String
[src]
fn tt_to_string(&self, tt: &TokenTree) -> String
[src]
fn tts_to_string(&self, tokens: &TokenStream) -> String
[src]
fn stmt_to_string(&self, stmt: &Stmt) -> String
[src]
fn item_to_string(&self, i: &Item) -> String
[src]
fn generic_params_to_string(&self, generic_params: &[GenericParam]) -> String
[src]
fn path_to_string(&self, p: &Path) -> String
[src]
fn path_segment_to_string(&self, p: &PathSegment) -> String
[src]
fn vis_to_string(&self, v: &Visibility) -> String
[src]
fn block_to_string(&self, blk: &Block) -> String
[src]
fn meta_list_item_to_string(&self, li: &NestedMetaItem) -> String
[src]
fn attr_item_to_string(&self, ai: &AttrItem) -> String
[src]
fn attribute_to_string(&self, attr: &Attribute) -> String
[src]
fn param_to_string(&self, arg: &Param) -> String
[src]
fn to_string(&self, f: impl FnOnce(&mut State<'_>)) -> String
[src]
Implementors
impl<'a> PrintState<'a> for State<'a>
[src]
impl<'a> PrintState<'a> for State<'a>
[src]