5 pub use state
::{print_crate, AnnNode, Comments, PpAnn, PrintState, State}
;
8 use rustc_ast
::token
::{Nonterminal, Token, TokenKind}
;
9 use rustc_ast
::tokenstream
::{TokenStream, TokenTree}
;
11 pub fn nonterminal_to_string(nt
: &Nonterminal
) -> String
{
12 State
::new().nonterminal_to_string(nt
)
15 /// Print the token kind precisely, without converting `$crate` into its respective crate name.
16 pub fn token_kind_to_string(tok
: &TokenKind
) -> String
{
17 State
::new().token_kind_to_string(tok
)
20 /// Print the token precisely, without converting `$crate` into its respective crate name.
21 pub fn token_to_string(token
: &Token
) -> String
{
22 State
::new().token_to_string(token
)
25 pub fn ty_to_string(ty
: &ast
::Ty
) -> String
{
26 State
::new().ty_to_string(ty
)
29 pub fn bounds_to_string(bounds
: &[ast
::GenericBound
]) -> String
{
30 State
::new().bounds_to_string(bounds
)
33 pub fn pat_to_string(pat
: &ast
::Pat
) -> String
{
34 State
::new().pat_to_string(pat
)
37 pub fn expr_to_string(e
: &ast
::Expr
) -> String
{
38 State
::new().expr_to_string(e
)
41 pub fn tt_to_string(tt
: &TokenTree
) -> String
{
42 State
::new().tt_to_string(tt
)
45 pub fn tts_to_string(tokens
: &TokenStream
) -> String
{
46 State
::new().tts_to_string(tokens
)
49 pub fn item_to_string(i
: &ast
::Item
) -> String
{
50 State
::new().item_to_string(i
)
53 pub fn path_to_string(p
: &ast
::Path
) -> String
{
54 State
::new().path_to_string(p
)
57 pub fn path_segment_to_string(p
: &ast
::PathSegment
) -> String
{
58 State
::new().path_segment_to_string(p
)
61 pub fn vis_to_string(v
: &ast
::Visibility
) -> String
{
62 State
::new().vis_to_string(v
)
65 pub fn meta_list_item_to_string(li
: &ast
::NestedMetaItem
) -> String
{
66 State
::new().meta_list_item_to_string(li
)
69 pub fn attribute_to_string(attr
: &ast
::Attribute
) -> String
{
70 State
::new().attribute_to_string(attr
)
73 pub fn to_string(f
: impl FnOnce(&mut State
<'_
>)) -> String
{
74 State
::new().to_string(f
)