LeanPrinter

Struct LeanPrinter 

Source
pub struct LeanPrinter;
Expand description

The Lean printer

Implementations§

Source§

impl LeanPrinter

Source

pub fn printable_item(item: &Item) -> bool

A filter for items blacklisted by the Lean backend : returns false if the item is definitely not printable, but might return true on unsupported items

Source

pub fn render_id(&self, id: &GlobalId) -> String

Render a global id using the Rendering strategy of the Lean printer. Works for both concrete and projector ids. TODO: https://github.com/cryspen/hax/issues/1660

Source

pub fn escape(&self, id: String) -> String

Escapes local identifiers (prefixing reserved keywords with an underscore). TODO: This should be treated directly in the name rendering engine, see https://github.com/cryspen/hax/issues/1630

Source

pub fn render_symbol(&self, symbol: Symbol) -> String

Renders a single symbol, used for anonymous implementations of typeclasses

Source

pub fn render_last(&self, id: &GlobalId) -> String

Renders the last, most local part of an id. Used for named arguments of constructors.

Source§

impl LeanPrinter

Source

pub fn arguments<'a, 'b, A: 'a + Clone, D>( &'a self, fields: &'b [(GlobalId, D)], is_record: &bool, ) -> DocBuilder<'a, Self, A>
where &'b D: Pretty<'a, Self, A>,

Prints arguments a variant or constructor of struct, using named or unamed arguments based on the is_record flag. Used for both expressions and patterns

Trait Implementations§

Source§

impl Default for LeanPrinter

Source§

fn default() -> LeanPrinter

Returns the “default value” for a type. Read more
Source§

impl<'a, A: 'a> DocAllocator<'a, A> for LeanPrinter

Source§

type Doc = BoxDoc<'a, A>

Source§

fn alloc(&'a self, doc: Doc<'a, Self::Doc, A>) -> Self::Doc

Source§

fn alloc_column_fn( &'a self, f: impl Fn(usize) -> Self::Doc + 'a, ) -> <Self::Doc as DocPtr<'a, A>>::ColumnFn

Source§

fn alloc_width_fn( &'a self, f: impl Fn(isize) -> Self::Doc + 'a, ) -> <Self::Doc as DocPtr<'a, A>>::WidthFn

Source§

fn alloc_cow(&'a self, doc: BuildDoc<'a, Self::Doc, A>) -> Self::Doc

Source§

fn nil(&'a self) -> DocBuilder<'a, Self, A>

Allocate an empty document.
Source§

fn fail(&'a self) -> DocBuilder<'a, Self, A>

Fails document rendering immediately. Read more
Source§

fn hardline(&'a self) -> DocBuilder<'a, Self, A>

Allocate a single hardline.
Source§

fn space(&'a self) -> DocBuilder<'a, Self, A>

Source§

fn line(&'a self) -> DocBuilder<'a, Self, A>

A line acts like a \n but behaves like space if it is grouped on a single line.
Source§

fn line_(&'a self) -> DocBuilder<'a, Self, A>

Acts like line but behaves like nil if grouped on a single line Read more
Source§

fn softline(&'a self) -> DocBuilder<'a, Self, A>

A softline acts like space if the document fits the page, otherwise like line
Source§

fn softline_(&'a self) -> DocBuilder<'a, Self, A>

A softline_ acts like nil if the document fits the page, otherwise like line_
Source§

fn as_string<U>(&'a self, data: U) -> DocBuilder<'a, Self, A>
where U: Display,

Allocate a document containing the text t.to_string(). Read more
Source§

fn text<U>(&'a self, data: U) -> DocBuilder<'a, Self, A>
where U: Into<Cow<'a, str>>,

Allocate a document containing the given text. Read more
Source§

fn concat<I>(&'a self, docs: I) -> DocBuilder<'a, Self, A>
where I: IntoIterator, <I as IntoIterator>::Item: Pretty<'a, Self, A>,

Allocate a document concatenating the given documents.
Source§

fn intersperse<I, S>(&'a self, docs: I, separator: S) -> DocBuilder<'a, Self, A>
where I: IntoIterator, <I as IntoIterator>::Item: Pretty<'a, Self, A>, S: Pretty<'a, Self, A> + Clone,

Allocate a document that intersperses the given separator S between the given documents [A, B, C, ..., Z], yielding [A, S, B, S, C, S, ..., S, Z]. Read more
Source§

fn column( &'a self, f: impl Fn(usize) -> Self::Doc + 'a, ) -> DocBuilder<'a, Self, A>

Allocate a document that acts differently based on the position and page layout Read more
Source§

fn nesting( &'a self, f: impl Fn(usize) -> Self::Doc + 'a, ) -> DocBuilder<'a, Self, A>

Allocate a document that acts differently based on the current nesting level Read more
Source§

fn reflow(&'a self, text: &'a str) -> DocBuilder<'a, Self, A>
where Self: Sized, Self::Doc: Clone, A: Clone,

Reflows text inserting softline in place of any whitespace
Source§

impl<'a, A: 'a + Clone> Pretty<'a, LeanPrinter, A> for &Vec<Param>

Render parameters, adding a line after each parameter

Source§

fn pretty(self, allocator: &'a LeanPrinter) -> DocBuilder<'a, LeanPrinter, A>

Converts self into a document
Source§

impl<'a, 'b, A: 'a + Clone> PrettyAst<'a, 'b, A> for LeanPrinter

Source§

fn generics(&'a self, _: &'b Generics) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.

Render generics, adding a space after each parameter

Source§

const NAME: &'static str = "Lean"

A name for this instance of PrettyAst. Useful for diagnostics and debugging.
Source§

fn module(&'a self, module: &'b Module) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn global_id(&'a self, global_id: &'b GlobalId) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn generic_constraint( &'a self, generic_constraint: &'b GenericConstraint, ) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn generic_param( &'a self, generic_param: &'b GenericParam, ) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn expr(&'a self, _: &'b Expr) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn arm(&'a self, arm: &'b Arm) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn pat(&'a self, pat: &'b Pat) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn pat_kind(&'a self, pat_kind: &'b PatKind) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn ty(&'a self, ty: &'b Ty) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn literal(&'a self, literal: &'b Literal) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn local_id(&'a self, local_id: &'b LocalId) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn spanned_ty(&'a self, spanned_ty: &'b SpannedTy) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn primitive_ty( &'a self, primitive_ty: &'b PrimitiveTy, ) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn int_kind(&'a self, int_kind: &'b IntKind) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn generic_value( &'a self, generic_value: &'b GenericValue, ) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn quote_content( &'a self, quote_content: &'b QuoteContent, ) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn quote(&'a self, quote: &'b Quote) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn param(&'a self, param: &'b Param) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn item(&'a self, item: &'b Item) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn trait_item(&'a self, _: &'b TraitItem) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn impl_item(&'a self, _: &'b ImplItem) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn impl_ident(&'a self, _: &'b ImplIdent) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn trait_goal(&'a self, _: &'b TraitGoal) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn variant(&'a self, _: &'b Variant) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn emit_diagnostic(&'a self, kind: Kind)

Emit a diagnostic with proper context and span.
Source§

fn todo_document( &'a self, message: &str, issue_id: Option<u32>, ) -> DocBuilder<'a, Self, A>

Produce a non-panicking placeholder document. In general, prefer the use of the helper macro todo_document!.
Source§

fn with_span<T>(&self, span: Span, action: impl Fn(&Self) -> T) -> T

Execute an action with a span hint. Useful for errors.
Source§

fn unimplemented_method( &'a self, method: &str, ast: FragmentRef<'_>, ) -> DocBuilder<'a, Self, A>

Produce a structured error document for an unimplemented method. Read more
Source§

fn expr_kind(&'a self, expr_kind: &'b ExprKind) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn ty_kind(&'a self, ty_kind: &'b TyKind) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn metadata(&'a self, metadata: &'b Metadata) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn lhs(&'a self, lhs: &'b Lhs) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn symbol(&'a self, symbol: &'b Symbol) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn loop_kind(&'a self, loop_kind: &'b LoopKind) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn safety_kind(&'a self, safety_kind: &'b SafetyKind) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn binding_mode( &'a self, binding_mode: &'b BindingMode, ) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn region(&'a self, region: &'b Region) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn impl_expr(&'a self, impl_expr: &'b ImplExpr) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn float_kind(&'a self, float_kind: &'b FloatKind) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn loop_state(&'a self, loop_state: &'b LoopState) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn control_flow_kind( &'a self, control_flow_kind: &'b ControlFlowKind, ) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn dyn_trait_goal( &'a self, dyn_trait_goal: &'b DynTraitGoal, ) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn attribute(&'a self, attribute: &'b Attribute) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn borrow_kind(&'a self, borrow_kind: &'b BorrowKind) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn impl_expr_kind( &'a self, impl_expr_kind: &'b ImplExprKind, ) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn int_size(&'a self, int_size: &'b IntSize) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn signedness(&'a self, signedness: &'b Signedness) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn guard(&'a self, guard: &'b Guard) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn attribute_kind( &'a self, attribute_kind: &'b AttributeKind, ) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn guard_kind(&'a self, guard_kind: &'b GuardKind) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn impl_item_kind( &'a self, impl_item_kind: &'b ImplItemKind, ) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn trait_item_kind( &'a self, trait_item_kind: &'b TraitItemKind, ) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn item_quote_origin( &'a self, item_quote_origin: &'b ItemQuoteOrigin, ) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn item_quote_origin_kind( &'a self, item_quote_origin_kind: &'b ItemQuoteOriginKind, ) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn item_quote_origin_position( &'a self, item_quote_origin_position: &'b ItemQuoteOriginPosition, ) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn generic_param_kind( &'a self, generic_param_kind: &'b GenericParamKind, ) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn projection_predicate( &'a self, projection_predicate: &'b ProjectionPredicate, ) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn doc_comment_kind( &'a self, doc_comment_kind: &'b DocCommentKind, ) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn item_kind(&'a self, item_kind: &'b ItemKind) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn error_node(&'a self, error_node: &'b ErrorNode) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn resugared_expr_kind( &'a self, resugared_expr_kind: &'b ResugaredExprKind, ) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn resugared_ty_kind( &'a self, resugared_ty_kind: &'b ResugaredTyKind, ) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn resugared_pat_kind( &'a self, resugared_pat_kind: &'b ResugaredPatKind, ) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn resugared_impl_item_kind( &'a self, resugared_impl_item_kind: &'b ResugaredImplItemKind, ) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn resugared_trait_item_kind( &'a self, resugared_trait_item_kind: &'b ResugaredTraitItemKind, ) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

fn resugared_item_kind( &'a self, resugared_item_kind: &'b ResugaredItemKind, ) -> DocBuilder<'a, Self, A>

👎Deprecated: Do not call this method directly. Use [pretty::Pretty::pretty] instead, so annotations/spans are preserved correctly.
Define how the printer formats a value of this AST type. Do not call this method directly. Use pretty::Pretty::pretty instead, so annotations/spans are preserved correctly.
Source§

impl Printer for LeanPrinter

Source§

fn resugaring_phases() -> Vec<Box<dyn Resugaring>>

A list of resugaring phases.
Source§

const NAME: &'static str = _

The name of the printer
Source§

impl RenderView for LeanPrinter

Source§

fn separator(&self) -> &str

Returns the string used to join rendered atoms (defaults to "::"). Read more
Source§

fn render_path_segment(&self, chunk: &PathSegment) -> Vec<String>

Renders a single PathSegment into a vector of display atoms. Read more
Source§

fn render_unnamed_path_segment_payload( &self, unnamed: UnnamedPathSegmentPayload, ) -> Symbol

Converts an unnamed path segment payload into a printable Symbol. Read more
Source§

fn render_path_segment_payload(&self, payload: PathSegmentPayload) -> Symbol

Converts a full PathSegmentPayload (named or unnamed) into a printable Symbol. Read more
Source§

fn module(&self, view: &View) -> Vec<String>

Renders just the module path (crate + modules) of a View, as a list of atoms. Read more
Source§

fn render(&self, view: &View) -> Rendered

Renders a View into a structured Rendered value, splitting output into module and path parts. Read more
Source§

fn rendered_to_strings( &self, rendered: Rendered, ) -> impl Iterator<Item = String>

Lazy render a view as an iterator of strings. Read more
Source§

fn rendered_to_string(&self, rendered: Rendered) -> String

Joins the atoms contained in a Rendered into a single string using separator. Read more
Source§

fn render_string(&self, view: &View) -> String

Convenience: renders a View straight to a single String.
Source§

fn render_strings(&self, view: &View) -> impl Iterator<Item = String>

Convenience: renders a View straight to a iterator of Strings.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<P, T> Print<T> for P
where P: Printer,

Source§

fn print(&self, fragment: T) -> (String, SourceMap)
where for<'a, 'b> &'b T: Pretty<'a, Self, Span>, for<'a> dyn Resugaring: AstVisitableMut<'a, T>,

Print a single AST fragment using this backend.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more