[−][src]Struct rustc_ast_pretty::pprust::state::State
Fields
s: Printercomments: Option<Comments<'a>>ann: &'a (dyn PpAnn + 'a)is_expanded: boolinsert_extra_parens: boolImplementations
impl<'a> State<'a>[src]
pub fn new() -> State<'a>[src]
pub(in pprust) fn without_insert_extra_parens(
) -> State<'a>[src]
) -> State<'a>
pub fn synth_comment(&mut self, text: String)[src]
pub(crate) fn commasep_cmnt<T, F, G>(
&mut self,
b: Breaks,
elts: &[T],
op: F,
get_span: G
) where
F: FnMut(&mut State<'_>, &T),
G: FnMut(&T) -> Span, [src]
&mut self,
b: Breaks,
elts: &[T],
op: F,
get_span: G
) where
F: FnMut(&mut State<'_>, &T),
G: FnMut(&T) -> Span,
pub(crate) fn commasep_exprs(&mut self, b: Breaks, exprs: &[P<Expr>])[src]
pub fn print_mod(&mut self, _mod: &Mod, attrs: &[Attribute])[src]
pub(crate) fn print_foreign_mod(
&mut self,
nmod: &ForeignMod,
attrs: &[Attribute]
)[src]
&mut self,
nmod: &ForeignMod,
attrs: &[Attribute]
)
pub fn print_opt_lifetime(&mut self, lifetime: &Option<Lifetime>)[src]
pub fn print_assoc_constraint(&mut self, constraint: &AssocTyConstraint)[src]
pub fn print_generic_arg(&mut self, generic_arg: &GenericArg)[src]
pub fn print_type(&mut self, ty: &Ty)[src]
pub(crate) fn print_foreign_item(&mut self, item: &ForeignItem)[src]
pub(in pprust::state) fn print_item_const(
&mut self,
ident: Ident,
mutbl: Option<Mutability>,
ty: &Ty,
body: Option<&Expr>,
vis: &Visibility,
defaultness: Defaultness
)[src]
&mut self,
ident: Ident,
mutbl: Option<Mutability>,
ty: &Ty,
body: Option<&Expr>,
vis: &Visibility,
defaultness: Defaultness
)
pub(in pprust::state) fn print_associated_type(
&mut self,
ident: Ident,
generics: &Generics,
bounds: &GenericBounds,
ty: Option<&Ty>,
vis: &Visibility,
defaultness: Defaultness
)[src]
&mut self,
ident: Ident,
generics: &Generics,
bounds: &GenericBounds,
ty: Option<&Ty>,
vis: &Visibility,
defaultness: Defaultness
)
pub(crate) fn print_item(&mut self, item: &Item)[src]
Pretty-prints an item.
pub(in pprust::state) fn print_trait_ref(
&mut self,
t: &TraitRef
)[src]
&mut self,
t: &TraitRef
)
pub(in pprust::state) fn print_formal_generic_params(
&mut self,
generic_params: &[GenericParam]
)[src]
&mut self,
generic_params: &[GenericParam]
)
pub(in pprust::state) fn print_poly_trait_ref(
&mut self,
t: &PolyTraitRef
)[src]
&mut self,
t: &PolyTraitRef
)
pub(crate) fn print_enum_def(
&mut self,
enum_definition: &EnumDef,
generics: &Generics,
ident: Ident,
span: Span,
visibility: &Visibility
)[src]
&mut self,
enum_definition: &EnumDef,
generics: &Generics,
ident: Ident,
span: Span,
visibility: &Visibility
)
pub(crate) fn print_variants(&mut self, variants: &[Variant], span: Span)[src]
pub(crate) fn print_visibility(&mut self, vis: &Visibility)[src]
pub(crate) fn print_defaultness(&mut self, defaultness: Defaultness)[src]
pub(crate) fn print_struct(
&mut self,
struct_def: &VariantData,
generics: &Generics,
ident: Ident,
span: Span,
print_finalizer: bool
)[src]
&mut self,
struct_def: &VariantData,
generics: &Generics,
ident: Ident,
span: Span,
print_finalizer: bool
)
pub(crate) fn print_variant(&mut self, v: &Variant)[src]
pub(crate) fn print_assoc_item(&mut self, item: &AssocItem)[src]
pub(crate) fn print_stmt(&mut self, st: &Stmt)[src]
pub(crate) fn print_block(&mut self, blk: &Block)[src]
pub(crate) fn print_block_unclosed_indent(&mut self, blk: &Block)[src]
pub(crate) fn print_block_with_attrs(
&mut self,
blk: &Block,
attrs: &[Attribute]
)[src]
&mut self,
blk: &Block,
attrs: &[Attribute]
)
pub(crate) fn print_block_maybe_unclosed(
&mut self,
blk: &Block,
attrs: &[Attribute],
close_box: bool
)[src]
&mut self,
blk: &Block,
attrs: &[Attribute],
close_box: bool
)
pub(crate) fn print_let(&mut self, pat: &Pat, scrutinee: &Expr)[src]
Print a let pat = scrutinee expression.
pub(in pprust::state) fn print_else(
&mut self,
els: Option<&Expr>
)[src]
&mut self,
els: Option<&Expr>
)
pub(crate) fn print_if(
&mut self,
test: &Expr,
blk: &Block,
elseopt: Option<&Expr>
)[src]
&mut self,
test: &Expr,
blk: &Block,
elseopt: Option<&Expr>
)
pub(crate) fn print_mac(&mut self, m: &MacCall)[src]
pub(in pprust::state) fn print_call_post(
&mut self,
args: &[P<Expr>]
)[src]
&mut self,
args: &[P<Expr>]
)
pub(crate) fn print_expr_maybe_paren(&mut self, expr: &Expr, prec: i8)[src]
pub(crate) fn print_expr_as_cond(&mut self, expr: &Expr)[src]
Prints an expr using syntax that's acceptable in a condition position, such as the cond in
if cond { ... }.
pub(in pprust::state) fn cond_needs_par(
expr: &Expr
) -> bool[src]
expr: &Expr
) -> bool
Does expr need parenthesis when printed in a condition position?
pub(in pprust::state) fn print_expr_cond_paren(
&mut self,
expr: &Expr,
needs_par: bool
)[src]
&mut self,
expr: &Expr,
needs_par: bool
)
Prints expr or (expr) when needs_par holds.
pub(in pprust::state) fn print_expr_vec(
&mut self,
exprs: &[P<Expr>],
attrs: &[Attribute]
)[src]
&mut self,
exprs: &[P<Expr>],
attrs: &[Attribute]
)
pub(in pprust::state) fn print_expr_anon_const(
&mut self,
expr: &AnonConst,
attrs: &[Attribute]
)[src]
&mut self,
expr: &AnonConst,
attrs: &[Attribute]
)
pub(in pprust::state) fn print_expr_repeat(
&mut self,
element: &Expr,
count: &AnonConst,
attrs: &[Attribute]
)[src]
&mut self,
element: &Expr,
count: &AnonConst,
attrs: &[Attribute]
)
pub(in pprust::state) fn print_expr_struct(
&mut self,
path: &Path,
fields: &[Field],
rest: &StructRest,
attrs: &[Attribute]
)[src]
&mut self,
path: &Path,
fields: &[Field],
rest: &StructRest,
attrs: &[Attribute]
)
pub(in pprust::state) fn print_expr_tup(
&mut self,
exprs: &[P<Expr>],
attrs: &[Attribute]
)[src]
&mut self,
exprs: &[P<Expr>],
attrs: &[Attribute]
)
pub(in pprust::state) fn print_expr_call(
&mut self,
func: &Expr,
args: &[P<Expr>]
)[src]
&mut self,
func: &Expr,
args: &[P<Expr>]
)
pub(in pprust::state) fn print_expr_method_call(
&mut self,
segment: &PathSegment,
args: &[P<Expr>]
)[src]
&mut self,
segment: &PathSegment,
args: &[P<Expr>]
)
pub(in pprust::state) fn print_expr_binary(
&mut self,
op: BinOp,
lhs: &Expr,
rhs: &Expr
)[src]
&mut self,
op: BinOp,
lhs: &Expr,
rhs: &Expr
)
pub(in pprust::state) fn print_expr_unary(
&mut self,
op: UnOp,
expr: &Expr
)[src]
&mut self,
op: UnOp,
expr: &Expr
)
pub(in pprust::state) fn print_expr_addr_of(
&mut self,
kind: BorrowKind,
mutability: Mutability,
expr: &Expr
)[src]
&mut self,
kind: BorrowKind,
mutability: Mutability,
expr: &Expr
)
pub fn print_expr(&mut self, expr: &Expr)[src]
pub(in pprust::state) fn print_expr_outer_attr_style(
&mut self,
expr: &Expr,
is_inline: bool
)[src]
&mut self,
expr: &Expr,
is_inline: bool
)
pub(crate) fn print_local_decl(&mut self, loc: &Local)[src]
pub fn print_usize(&mut self, i: usize)[src]
pub(crate) fn print_name(&mut self, name: Symbol)[src]
pub(in pprust::state) fn print_qpath(
&mut self,
path: &Path,
qself: &QSelf,
colons_before_params: bool
)[src]
&mut self,
path: &Path,
qself: &QSelf,
colons_before_params: bool
)
pub(crate) fn print_pat(&mut self, pat: &Pat)[src]
pub(in pprust::state) fn print_arm(
&mut self,
arm: &Arm
)[src]
&mut self,
arm: &Arm
)
pub(in pprust::state) fn print_explicit_self(
&mut self,
explicit_self: &ExplicitSelf
)[src]
&mut self,
explicit_self: &ExplicitSelf
)
pub(in pprust::state) fn print_fn_full(
&mut self,
sig: &FnSig,
name: Ident,
generics: &Generics,
vis: &Visibility,
defaultness: Defaultness,
body: Option<&Block>,
attrs: &[Attribute]
)[src]
&mut self,
sig: &FnSig,
name: Ident,
generics: &Generics,
vis: &Visibility,
defaultness: Defaultness,
body: Option<&Block>,
attrs: &[Attribute]
)
pub(crate) fn print_fn(
&mut self,
decl: &FnDecl,
header: FnHeader,
name: Option<Ident>,
generics: &Generics
)[src]
&mut self,
decl: &FnDecl,
header: FnHeader,
name: Option<Ident>,
generics: &Generics
)
pub(crate) fn print_fn_params_and_ret(
&mut self,
decl: &FnDecl,
is_closure: bool
)[src]
&mut self,
decl: &FnDecl,
is_closure: bool
)
pub(crate) fn print_movability(&mut self, movability: Movability)[src]
pub(crate) fn print_asyncness(&mut self, asyncness: Async)[src]
pub(crate) fn print_capture_clause(&mut self, capture_clause: CaptureBy)[src]
pub fn print_type_bounds(
&mut self,
prefix: &'static str,
bounds: &[GenericBound]
)[src]
&mut self,
prefix: &'static str,
bounds: &[GenericBound]
)
pub(crate) fn print_lifetime(&mut self, lifetime: Lifetime)[src]
pub(crate) fn print_lifetime_bounds(
&mut self,
lifetime: Lifetime,
bounds: &GenericBounds
)[src]
&mut self,
lifetime: Lifetime,
bounds: &GenericBounds
)
pub(crate) fn print_generic_params(&mut self, generic_params: &[GenericParam])[src]
pub(crate) fn print_where_clause(&mut self, where_clause: &WhereClause)[src]
pub(crate) fn print_use_tree(&mut self, tree: &UseTree)[src]
pub fn print_mutability(&mut self, mutbl: Mutability, print_const: bool)[src]
pub(crate) fn print_mt(&mut self, mt: &MutTy, print_const: bool)[src]
pub(crate) fn print_param(&mut self, input: &Param, is_closure: bool)[src]
pub(crate) fn print_fn_ret_ty(&mut self, fn_ret_ty: &FnRetTy)[src]
pub(crate) fn print_ty_fn(
&mut self,
ext: Extern,
unsafety: Unsafe,
decl: &FnDecl,
name: Option<Ident>,
generic_params: &[GenericParam]
)[src]
&mut self,
ext: Extern,
unsafety: Unsafe,
decl: &FnDecl,
name: Option<Ident>,
generic_params: &[GenericParam]
)
pub(crate) fn maybe_print_trailing_comment(
&mut self,
span: Span,
next_pos: Option<BytePos>
)[src]
&mut self,
span: Span,
next_pos: Option<BytePos>
)
pub(crate) fn print_remaining_comments(&mut self)[src]
pub(crate) fn print_fn_header_info(&mut self, header: FnHeader)[src]
pub(crate) fn print_unsafety(&mut self, s: Unsafe)[src]
pub(crate) fn print_constness(&mut self, s: Const)[src]
pub(crate) fn print_is_auto(&mut self, s: IsAuto)[src]
Methods from Deref<Target = Printer>
pub fn word_space<W: Into<Cow<'static, str>>>(&mut self, w: W)[src]
pub fn popen(&mut self)[src]
pub fn pclose(&mut self)[src]
pub fn hardbreak_if_not_bol(&mut self)[src]
pub fn space_if_not_bol(&mut self)[src]
pub fn nbsp(&mut self)[src]
pub fn word_nbsp<S: Into<Cow<'static, str>>>(&mut self, w: S)[src]
pub fn last_token(&self) -> Token[src]
pub fn replace_last_token(&mut self, t: Token)[src]
Be very careful with this!
pub(in pp) fn scan_eof(
&mut self
)[src]
&mut self
)
pub(in pp) fn scan_begin(
&mut self,
b: BeginToken
)[src]
&mut self,
b: BeginToken
)
pub(in pp) fn scan_end(
&mut self
)[src]
&mut self
)
pub(in pp) fn scan_break(
&mut self,
b: BreakToken
)[src]
&mut self,
b: BreakToken
)
pub(in pp) fn scan_string(
&mut self,
s: Cow<'static, str>
)[src]
&mut self,
s: Cow<'static, str>
)
pub(in pp) fn check_stream(
&mut self
)[src]
&mut self
)
pub(in pp) fn scan_push(
&mut self,
entry: BufEntry
)[src]
&mut self,
entry: BufEntry
)
pub(in pp) fn scan_pop(
&mut self
) -> usize[src]
&mut self
) -> usize
pub(in pp) fn scan_top(
&self
) -> usize[src]
&self
) -> usize
pub(in pp) fn scan_pop_bottom(
&mut self
) -> usize[src]
&mut self
) -> usize
pub(in pp) fn advance_right(
&mut self
)[src]
&mut self
)
pub(in pp) fn advance_left(
&mut self
)[src]
&mut self
)
pub(in pp) fn check_stack(
&mut self,
k: usize
)[src]
&mut self,
k: usize
)
pub(in pp) fn print_newline(
&mut self,
amount: isize
)[src]
&mut self,
amount: isize
)
pub(in pp) fn indent(
&mut self,
amount: isize
)[src]
&mut self,
amount: isize
)
pub(in pp) fn get_top(
&self
) -> PrintStackElem[src]
&self
) -> PrintStackElem
pub(in pp) fn print_begin(
&mut self,
b: BeginToken,
l: isize
)[src]
&mut self,
b: BeginToken,
l: isize
)
pub(in pp) fn print_end(
&mut self
)[src]
&mut self
)
pub(in pp) fn print_break(
&mut self,
b: BreakToken,
l: isize
)[src]
&mut self,
b: BreakToken,
l: isize
)
pub(in pp) fn print_string(
&mut self,
s: Cow<'static, str>
)[src]
&mut self,
s: Cow<'static, str>
)
pub(in pp) fn print(
&mut self,
token: Token,
l: isize
)[src]
&mut self,
token: Token,
l: isize
)
pub fn rbox(&mut self, indent: usize, b: Breaks)[src]
"raw box"
pub fn ibox(&mut self, indent: usize)[src]
Inconsistent breaking box
pub fn cbox(&mut self, indent: usize)[src]
Consistent breaking box
pub fn break_offset(&mut self, n: usize, off: isize)[src]
pub fn end(&mut self)[src]
pub fn word<S: Into<Cow<'static, str>>>(&mut self, wrd: S)[src]
pub(in pp) fn spaces(
&mut self,
n: usize
)[src]
&mut self,
n: usize
)
pub(crate) fn zerobreak(&mut self)[src]
pub fn space(&mut self)[src]
pub fn hardbreak(&mut self)[src]
pub fn is_beginning_of_line(&self) -> bool[src]
Trait Implementations
impl<'_> Deref for State<'_>[src]
type Target = Printer
The resulting type after dereferencing.
pub fn deref(&self) -> &Self::Target[src]
impl<'_> DerefMut for State<'_>[src]
impl<'a> PrintState<'a> for State<'a>[src]
pub fn insert_extra_parens(&self) -> bool[src]
pub fn comments(&mut self) -> &mut Option<Comments<'a>>[src]
pub fn print_ident(&mut self, ident: Ident)[src]
pub fn print_generic_args(
&mut self,
args: &GenericArgs,
colons_before_params: bool
)[src]
&mut self,
args: &GenericArgs,
colons_before_params: bool
)
pub 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),
pub fn commasep<T, F>(&mut self, b: Breaks, elts: &[T], op: F) where
F: FnMut(&mut Self, &T), [src]
F: FnMut(&mut Self, &T),
pub fn maybe_print_comment(&mut self, pos: BytePos)[src]
pub fn print_comment(&mut self, cmnt: &Comment)[src]
pub fn next_comment(&mut self) -> Option<Comment>[src]
pub fn print_literal(&mut self, lit: &Lit)[src]
pub fn print_string(&mut self, st: &str, style: StrStyle)[src]
pub fn print_symbol(&mut self, sym: Symbol, style: StrStyle)[src]
pub fn print_inner_attributes(&mut self, attrs: &[Attribute])[src]
pub fn print_inner_attributes_no_trailing_hardbreak(
&mut self,
attrs: &[Attribute]
)[src]
&mut self,
attrs: &[Attribute]
)
pub fn print_outer_attributes(&mut self, attrs: &[Attribute])[src]
pub fn print_inner_attributes_inline(&mut self, attrs: &[Attribute])[src]
pub fn print_outer_attributes_inline(&mut self, attrs: &[Attribute])[src]
pub 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
)
pub fn print_attribute(&mut self, attr: &Attribute)[src]
pub fn print_attribute_inline(&mut self, attr: &Attribute, is_inline: bool)[src]
pub fn print_attr_item(&mut self, item: &AttrItem, span: Span)[src]
pub fn print_meta_list_item(&mut self, item: &NestedMetaItem)[src]
pub fn print_meta_item(&mut self, item: &MetaItem)[src]
pub fn print_tt(&mut self, tt: &TokenTree, convert_dollar_crate: bool)[src]
pub fn print_tts(&mut self, tts: &TokenStream, convert_dollar_crate: bool)[src]
pub 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
)
pub fn print_path(
&mut self,
path: &Path,
colons_before_params: bool,
depth: usize
)[src]
&mut self,
path: &Path,
colons_before_params: bool,
depth: usize
)
pub fn print_path_segment(
&mut self,
segment: &PathSegment,
colons_before_params: bool
)[src]
&mut self,
segment: &PathSegment,
colons_before_params: bool
)
pub fn head<S: Into<Cow<'static, str>>>(&mut self, w: S)[src]
pub fn bopen(&mut self)[src]
pub fn bclose_maybe_open(&mut self, span: Span, close_box: bool)[src]
pub fn bclose(&mut self, span: Span)[src]
pub fn break_offset_if_not_bol(&mut self, n: usize, off: isize)[src]
pub fn nonterminal_to_string(&self, nt: &Nonterminal) -> String[src]
pub fn token_kind_to_string(&self, tok: &TokenKind) -> String[src]
pub 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
pub fn token_to_string(&self, token: &Token) -> String[src]
pub fn token_to_string_ext(
&self,
token: &Token,
convert_dollar_crate: bool
) -> String[src]
&self,
token: &Token,
convert_dollar_crate: bool
) -> String
pub fn ty_to_string(&self, ty: &Ty) -> String[src]
pub fn bounds_to_string(&self, bounds: &[GenericBound]) -> String[src]
pub fn pat_to_string(&self, pat: &Pat) -> String[src]
pub fn expr_to_string(&self, e: &Expr) -> String[src]
pub fn tt_to_string(&self, tt: &TokenTree) -> String[src]
pub fn tts_to_string(&self, tokens: &TokenStream) -> String[src]
pub fn stmt_to_string(&self, stmt: &Stmt) -> String[src]
pub fn item_to_string(&self, i: &Item) -> String[src]
pub fn generic_params_to_string(
&self,
generic_params: &[GenericParam]
) -> String[src]
&self,
generic_params: &[GenericParam]
) -> String
pub fn path_to_string(&self, p: &Path) -> String[src]
pub fn path_segment_to_string(&self, p: &PathSegment) -> String[src]
pub fn vis_to_string(&self, v: &Visibility) -> String[src]
pub fn block_to_string(&self, blk: &Block) -> String[src]
pub fn meta_list_item_to_string(&self, li: &NestedMetaItem) -> String[src]
pub fn attr_item_to_string(&self, ai: &AttrItem) -> String[src]
pub fn attribute_to_string(&self, attr: &Attribute) -> String[src]
pub fn param_to_string(&self, arg: &Param) -> String[src]
pub fn to_string(&self, f: impl FnOnce(&mut State<'_>)) -> String[src]
Auto Trait Implementations
impl<'a> !RefUnwindSafe for State<'a>
impl<'a> !Send for State<'a>
impl<'a> !Sync for State<'a>
impl<'a> Unpin for State<'a>
impl<'a> !UnwindSafe for State<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,