pub struct RustPrinter { /* private fields */ }Expand description
The Rust printer.
Trait Implementations§
Source§impl Clone for RustPrinter
impl Clone for RustPrinter
Source§fn clone(&self) -> RustPrinter
fn clone(&self) -> RustPrinter
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for RustPrinter
impl Default for RustPrinter
Source§fn default() -> RustPrinter
fn default() -> RustPrinter
Source§impl HasContextualSpan for RustPrinter
impl HasContextualSpan for RustPrinter
Source§impl HasLinkedItemGraph for RustPrinter
impl HasLinkedItemGraph for RustPrinter
Source§fn linked_item_graph(&self) -> &LinkedItemGraph
fn linked_item_graph(&self) -> &LinkedItemGraph
LinkedItemGraph.Source§fn with_linked_item_graph(self, graph: Rc<LinkedItemGraph>) -> Self
fn with_linked_item_graph(self, graph: Rc<LinkedItemGraph>) -> Self
LinkedItemGraph.Source§impl<A: Clone + 'static> PrettyAst<A> for RustPrinter
impl<A: Clone + 'static> PrettyAst<A> for RustPrinter
Source§const NAME: &'static str = "Rust"
const NAME: &'static str = "Rust"
PrettyAst.
Useful for diagnostics and debugging.Source§fn module(&self, module: &Module) -> DocBuilder<A>
fn module(&self, module: &Module) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn safety_kind(&self, safety_kind: &SafetyKind) -> DocBuilder<A>
fn safety_kind(&self, safety_kind: &SafetyKind) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn param(&self, param: &Param) -> DocBuilder<A>
fn param(&self, param: &Param) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn binding_mode(&self, binding_mode: &BindingMode) -> DocBuilder<A>
fn binding_mode(&self, binding_mode: &BindingMode) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn pat(&self, pat: &Pat) -> DocBuilder<A>
fn pat(&self, pat: &Pat) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn primitive_ty(&self, primitive_ty: &PrimitiveTy) -> DocBuilder<A>
fn primitive_ty(&self, primitive_ty: &PrimitiveTy) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn int_kind(&self, int_kind: &IntKind) -> DocBuilder<A>
fn int_kind(&self, int_kind: &IntKind) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn generic_param(&self, generic_param: &GenericParam) -> DocBuilder<A>
fn generic_param(&self, generic_param: &GenericParam) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn generic_constraint(
&self,
generic_constraint: &GenericConstraint,
) -> DocBuilder<A>
fn generic_constraint( &self, generic_constraint: &GenericConstraint, ) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn impl_ident(&self, impl_ident: &ImplIdent) -> DocBuilder<A>
fn impl_ident(&self, impl_ident: &ImplIdent) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn ty(&self, ty: &Ty) -> DocBuilder<A>
fn ty(&self, ty: &Ty) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn resugared_ty_kind(
&self,
resugared_ty_kind: &ResugaredTyKind,
) -> DocBuilder<A>
fn resugared_ty_kind( &self, resugared_ty_kind: &ResugaredTyKind, ) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn literal(&self, literal: &Literal) -> DocBuilder<A>
fn literal(&self, literal: &Literal) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn trait_goal(&self, trait_goal: &TraitGoal) -> DocBuilder<A>
fn trait_goal(&self, trait_goal: &TraitGoal) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn generic_value(&self, generic_value: &GenericValue) -> DocBuilder<A>
fn generic_value(&self, generic_value: &GenericValue) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn arm(&self, arm: &Arm) -> DocBuilder<A>
fn arm(&self, arm: &Arm) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn expr(&self, expr: &Expr) -> DocBuilder<A>
fn expr(&self, expr: &Expr) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn resugared_expr_kind(
&self,
resugared_expr_kind: &ResugaredExprKind,
) -> DocBuilder<A>
fn resugared_expr_kind( &self, resugared_expr_kind: &ResugaredExprKind, ) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn lhs(&self, lhs: &Lhs) -> DocBuilder<A>
fn lhs(&self, lhs: &Lhs) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn global_id(&self, global_id: &GlobalId) -> DocBuilder<A>
fn global_id(&self, global_id: &GlobalId) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn variant(&self, variant: &Variant) -> DocBuilder<A>
fn variant(&self, variant: &Variant) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn item(&self, item: &Item) -> DocBuilder<A>
fn item(&self, item: &Item) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn resugared_item_kind(
&self,
resugared_item_kind: &ResugaredItemKind,
) -> DocBuilder<A>
fn resugared_item_kind( &self, resugared_item_kind: &ResugaredItemKind, ) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn item_kind(&self, item_kind: &ItemKind) -> DocBuilder<A>
fn item_kind(&self, item_kind: &ItemKind) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn impl_item(&self, impl_item: &ImplItem) -> DocBuilder<A>
fn impl_item(&self, impl_item: &ImplItem) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn metadata(&self, metadata: &Metadata) -> DocBuilder<A>
fn metadata(&self, metadata: &Metadata) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn attribute(&self, attribute: &Attribute) -> DocBuilder<A>
fn attribute(&self, attribute: &Attribute) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn emit_diagnostic(&self, kind: Kind)
fn emit_diagnostic(&self, kind: Kind)
Source§fn todo_document(&self, message: &str, issue_id: Option<u32>) -> DocBuilder<A>
fn todo_document(&self, message: &str, issue_id: Option<u32>) -> DocBuilder<A>
todo_document!.Source§fn unimplemented_method(
&self,
method: &str,
ast: FragmentRef<'_>,
) -> DocBuilder<A>
fn unimplemented_method( &self, method: &str, ast: FragmentRef<'_>, ) -> DocBuilder<A>
Source§fn local_id(&self, local_id: &LocalId) -> DocBuilder<A>
fn local_id(&self, local_id: &LocalId) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn symbol(&self, symbol: &Symbol) -> DocBuilder<A>
fn symbol(&self, symbol: &Symbol) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn quote(&self, quote: &Quote) -> DocBuilder<A>
fn quote(&self, quote: &Quote) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn spanned_ty(&self, spanned_ty: &SpannedTy) -> DocBuilder<A>
fn spanned_ty(&self, spanned_ty: &SpannedTy) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn region(&self, region: &Region) -> DocBuilder<A>
fn region(&self, region: &Region) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn impl_expr(&self, impl_expr: &ImplExpr) -> DocBuilder<A>
fn impl_expr(&self, impl_expr: &ImplExpr) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn float_kind(&self, float_kind: &FloatKind) -> DocBuilder<A>
fn float_kind(&self, float_kind: &FloatKind) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn dyn_trait_goal(&self, dyn_trait_goal: &DynTraitGoal) -> DocBuilder<A>
fn dyn_trait_goal(&self, dyn_trait_goal: &DynTraitGoal) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn quote_content(&self, quote_content: &QuoteContent) -> DocBuilder<A>
fn quote_content(&self, quote_content: &QuoteContent) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn borrow_kind(&self, borrow_kind: &BorrowKind) -> DocBuilder<A>
fn borrow_kind(&self, borrow_kind: &BorrowKind) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn guard(&self, guard: &Guard) -> DocBuilder<A>
fn guard(&self, guard: &Guard) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn trait_item(&self, trait_item: &TraitItem) -> DocBuilder<A>
fn trait_item(&self, trait_item: &TraitItem) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn generic_param_kind(
&self,
generic_param_kind: &GenericParamKind,
) -> DocBuilder<A>
fn generic_param_kind( &self, generic_param_kind: &GenericParamKind, ) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn projection_predicate(
&self,
projection_predicate: &ProjectionPredicate,
) -> DocBuilder<A>
fn projection_predicate( &self, projection_predicate: &ProjectionPredicate, ) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn generics(&self, generics: &Generics) -> DocBuilder<A>
fn generics(&self, generics: &Generics) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn error_node(&self, error_node: &ErrorNode) -> DocBuilder<A>
fn error_node(&self, error_node: &ErrorNode) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn resugared_pat_kind(
&self,
resugared_pat_kind: &ResugaredPatKind,
) -> DocBuilder<A>
fn resugared_pat_kind( &self, resugared_pat_kind: &ResugaredPatKind, ) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn resugared_impl_item_kind(
&self,
resugared_impl_item_kind: &ResugaredImplItemKind,
) -> DocBuilder<A>
fn resugared_impl_item_kind( &self, resugared_impl_item_kind: &ResugaredImplItemKind, ) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§fn resugared_trait_item_kind(
&self,
resugared_trait_item_kind: &ResugaredTraitItemKind,
) -> DocBuilder<A>
fn resugared_trait_item_kind( &self, resugared_trait_item_kind: &ResugaredTraitItemKind, ) -> DocBuilder<A>
Do not call this method directly. Use ToDocument::to_document instead, so annotations/spans are preserved correctly.
ToDocument::to_document instead, so annotations/spans are preserved correctly.Source§impl RenderView for RustPrinter
impl RenderView for RustPrinter
Source§fn render_path_segment(&self, seg: &PathSegment) -> Vec<String>
fn render_path_segment(&self, seg: &PathSegment) -> Vec<String>
PathSegment into a vector of display atoms. Read moreSource§fn reserved_keywords() -> &'static HashSet<String>
fn reserved_keywords() -> &'static HashSet<String>
Source§fn is_reserved_keyword(id: &str) -> bool
fn is_reserved_keyword(id: &str) -> bool
Source§fn should_escape(id: &str) -> bool
fn should_escape(id: &str) -> bool
Source§fn escape(id: &str) -> String
fn escape(id: &str) -> String
Self::should_escapeSource§fn render_unnamed_path_segment_payload(
&self,
unnamed: UnnamedPathSegmentPayload,
) -> Symbol
fn render_unnamed_path_segment_payload( &self, unnamed: UnnamedPathSegmentPayload, ) -> Symbol
Source§fn render_path_segment_payload(&self, payload: PathSegmentPayload) -> Symbol
fn render_path_segment_payload(&self, payload: PathSegmentPayload) -> Symbol
Source§fn render_suffix(&self, suffix: &ReservedSuffix) -> String
fn render_suffix(&self, suffix: &ReservedSuffix) -> String
Source§fn relativize_module_path<'a>(
&self,
module_path: &'a [PathSegment],
) -> &'a [PathSegment]
fn relativize_module_path<'a>( &self, module_path: &'a [PathSegment], ) -> &'a [PathSegment]
Source§fn separator(&self) -> &str
fn separator(&self) -> &str
"::"). Read moreSource§fn rendered_to_strings(
&self,
rendered: Rendered,
) -> impl Iterator<Item = String>
fn rendered_to_strings( &self, rendered: Rendered, ) -> impl Iterator<Item = String>
Source§fn rendered_to_string(&self, rendered: Rendered) -> String
fn rendered_to_string(&self, rendered: Rendered) -> String
Auto Trait Implementations§
impl !Freeze for RustPrinter
impl !RefUnwindSafe for RustPrinter
impl !Send for RustPrinter
impl !Sync for RustPrinter
impl Unpin for RustPrinter
impl UnsafeUnpin for RustPrinter
impl UnwindSafe for RustPrinter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreimpl<T> IsBody for Twhere
T: Clone + 'static,
Source§impl<A, P> PrettyAstExt<A> for P
impl<A, P> PrettyAstExt<A> for P
Source§fn nil(&self) -> DocBuilder<A>
fn nil(&self) -> DocBuilder<A>
pretty::DocAllocator::nil.Source§fn fail(&self) -> DocBuilder<A>
fn fail(&self) -> DocBuilder<A>
pretty::DocAllocator::fail. Read moreSource§fn hardline(&self) -> DocBuilder<A>
fn hardline(&self) -> DocBuilder<A>
pretty::DocAllocator::hardline.Source§fn space(&self) -> DocBuilder<A>
fn space(&self) -> DocBuilder<A>
pretty::DocAllocator::space.Source§fn line(&self) -> DocBuilder<A>
fn line(&self) -> DocBuilder<A>
\n but behaves like space once grouped onto a single line.
Mirrors pretty::DocAllocator::line.Source§fn line_(&self) -> DocBuilder<A>
fn line_(&self) -> DocBuilder<A>
line but collapses to nil if grouped on a single line.
Mirrors pretty::DocAllocator::line_.Source§fn softline(&self) -> DocBuilder<A>
fn softline(&self) -> DocBuilder<A>
space when the document fits the page, otherwise behaves like line.
Mirrors pretty::DocAllocator::softline.Source§fn softline_(&self) -> DocBuilder<A>
fn softline_(&self) -> DocBuilder<A>
nil when the document fits the page, otherwise behaves like line_.
Mirrors pretty::DocAllocator::softline_.Source§fn as_string<U: Display>(&self, data: U) -> DocBuilder<A>
fn as_string<U: Display>(&self, data: U) -> DocBuilder<A>
Source§fn text<'a>(&self, data: impl Into<Cow<'a, str>>) -> DocBuilder<A>
fn text<'a>(&self, data: impl Into<Cow<'a, str>>) -> DocBuilder<A>
pretty::DocAllocator::text. Read moreSource§fn concat<I>(&self, docs: I) -> DocBuilder<A>
fn concat<I>(&self, docs: I) -> DocBuilder<A>
pretty::DocAllocator::concat.Source§fn intersperse<I, S>(&self, docs: I, separator: S) -> DocBuilder<A>where
I::Item: ToDocumentOwned<Self, A>,
I: IntoIterator,
S: ToDocumentOwned<Self, A> + Clone,
A: Clone,
fn intersperse<I, S>(&self, docs: I, separator: S) -> DocBuilder<A>where
I::Item: ToDocumentOwned<Self, A>,
I: IntoIterator,
S: ToDocumentOwned<Self, A> + Clone,
A: Clone,
separator between every pair.
Mirrors pretty::DocAllocator::intersperse. Read more