Skip to main content

LeanPrinter

Struct LeanPrinter 

Source
pub struct LeanPrinter { /* private fields */ }
Expand description

The Lean printer

Implementations§

Source§

impl LeanPrinter

Source

pub fn is_hax_core_models_extraction_mode(&self) -> bool

Checks if we are extracting core models to be able to use different namespeacing when referring to core.

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 render_last(&self, id: &GlobalId) -> String

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

Source

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

Inject an identifier in before-last position while rendering TODO: use DefIdInner::kind for this instead (https://github.com/cryspen/hax/issues/1877)

Source§

impl LeanPrinter

Source

pub fn arguments<A: 'static + Clone, D>( &self, fields: &[(GlobalId, D)], is_record: &bool, ) -> DocBuilder<A>
where D: ToDocument<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 Clone for LeanPrinter

Source§

fn clone(&self) -> LeanPrinter

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for LeanPrinter

Source§

fn default() -> LeanPrinter

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

impl HasContextualSpan for LeanPrinter

Source§

fn span(&self) -> Option<Span>

Returns the span currently associated with the printer, if any.
Source§

fn with_span(&self, span: Span) -> Self

Clone the printer, adding a span hint. Useful for errors.
Source§

impl HasLinkedItemGraph for LeanPrinter

Source§

fn linked_item_graph(&self) -> &LinkedItemGraph

Get a reference of the LinkedItemGraph.
Source§

fn with_linked_item_graph(self, graph: Rc<LinkedItemGraph>) -> Self

Set a LinkedItemGraph.
Source§

impl<A: 'static + Clone> PrettyAst<A> for LeanPrinter

Source§

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

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

Source§

const NAME: &'static str = "Lean"

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

fn module(&self, module: &Module) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn global_id(&self, global_id: &GlobalId) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn generics(&self, generics: &Generics) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn generic_constraint(&self, _: &GenericConstraint) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn generic_param(&self, generic_param: &GenericParam) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn generic_value(&self, generic_value: &GenericValue) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn expr(&self, _: &Expr) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn arm(&self, arm: &Arm) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn pat(&self, pat: &Pat) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn ty(&self, ty: &Ty) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn literal(&self, literal: &Literal) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn local_id(&self, local_id: &LocalId) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn spanned_ty(&self, spanned_ty: &SpannedTy) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn primitive_ty(&self, primitive_ty: &PrimitiveTy) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn int_kind(&self, int_kind: &IntKind) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn float_kind(&self, float_kind: &FloatKind) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn quote_content(&self, quote_content: &QuoteContent) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn quote(&self, quote: &Quote) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn param(&self, param: &Param) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn item(&self, item: &Item) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn impl_item(&self, _: &ImplItem) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn impl_ident(&self, _: &ImplIdent) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn trait_goal(&self, _: &TraitGoal) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn variant(&self, _: &Variant) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn symbol(&self, symbol: &Symbol) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn metadata(&self, _: &Metadata) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn lhs(&self, _lhs: &Lhs) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn safety_kind(&self, _safety_kind: &SafetyKind) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn binding_mode(&self, _binding_mode: &BindingMode) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn region(&self, _region: &Region) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn dyn_trait_goal(&self, _dyn_trait_goal: &DynTraitGoal) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn attribute(&self, _: &Attribute) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn borrow_kind(&self, _borrow_kind: &BorrowKind) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn guard(&self, _guard: &Guard) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn projection_predicate( &self, projection_predicate: &ProjectionPredicate, ) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn error_node(&self, _error_node: &ErrorNode) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn impl_expr(&self, _impl_expr: &ImplExpr) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn emit_diagnostic(&self, kind: Kind)

Emit a diagnostic with proper context and span.
Source§

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

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

fn trait_item(&self, trait_item: &TraitItem) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn generic_param_kind( &self, generic_param_kind: &GenericParamKind, ) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn item_kind(&self, item_kind: &ItemKind) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn resugared_expr_kind( &self, resugared_expr_kind: &ResugaredExprKind, ) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn resugared_ty_kind( &self, resugared_ty_kind: &ResugaredTyKind, ) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn resugared_pat_kind( &self, resugared_pat_kind: &ResugaredPatKind, ) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn resugared_impl_item_kind( &self, resugared_impl_item_kind: &ResugaredImplItemKind, ) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn resugared_trait_item_kind( &self, resugared_trait_item_kind: &ResugaredTraitItemKind, ) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

fn resugared_item_kind( &self, resugared_item_kind: &ResugaredItemKind, ) -> DocBuilder<A>

👎Deprecated:

Do not call this method directly. Use ToDocument::to_document 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 ToDocument::to_document instead, so annotations/spans are preserved correctly.
Source§

impl Printer for LeanPrinter

Source§

const NAME: &'static str = _

The name of the printer
Source§

impl RenderView for LeanPrinter

Source§

fn reserved_keywords() -> &'static HashSet<String>

List of reserved keywords that will be escaped when rendering
Source§

fn should_escape(id: &str) -> bool

Check if a string needs escaping
Source§

fn separator(&self) -> &str

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

fn relativize_module_path<'a>( &self, module_path: &'a [PathSegment], ) -> &'a [PathSegment]

Allows backends to adjust a module path before rendering, e.g., to shorten it according to currenly open namespaces.
Source§

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

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

fn is_reserved_keyword(id: &str) -> bool

Check if a string is a reserved keyword that needs escaping
Source§

fn escape(id: &str) -> String

Escape a string if it needs escaping according to Self::should_escape
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 render_suffix(&self, suffix: &ReservedSuffix) -> String

Renders the optional suffix
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.
Source§

impl<A: 'static + Clone> ToDocument<LeanPrinter, A> for Vec<Param>

Render parameters, adding a line after each parameter

Source§

fn to_document(&self, printer: &LeanPrinter) -> DocBuilder<A>

Produce a document using the provided printer reference.
Source§

impl<A: 'static + Clone> ToDocument<LeanPrinter, A> for (Vec<GenericParam>, &TraitItem)

Source§

fn to_document(&self, printer: &LeanPrinter) -> DocBuilder<A>

Produce a document using the provided printer reference.

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

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<T> IsBody for T
where T: Clone + 'static,

Source§

impl<A, P> PrettyAstExt<A> for P
where A: 'static + Clone, P: PrettyAst<A>,

Source§

fn nil(&self) -> DocBuilder<A>

Returns an empty document. Mirrors pretty::DocAllocator::nil.
Source§

fn fail(&self) -> DocBuilder<A>

Produces a document that fails rendering immediately. Mirrors pretty::DocAllocator::fail. Read more
Source§

fn hardline(&self) -> DocBuilder<A>

Inserts a mandatory line break. Mirrors pretty::DocAllocator::hardline.
Source§

fn space(&self) -> DocBuilder<A>

Inserts a single space that disappears when groups flatten. Mirrors pretty::DocAllocator::space.
Source§

fn line(&self) -> DocBuilder<A>

Acts like a \n but behaves like space once grouped onto a single line. Mirrors pretty::DocAllocator::line.
Source§

fn line_(&self) -> DocBuilder<A>

Acts like line but collapses to nil if grouped on a single line. Mirrors pretty::DocAllocator::line_.
Source§

fn softline(&self) -> DocBuilder<A>

Acts like space when the document fits the page, otherwise behaves like line. Mirrors pretty::DocAllocator::softline.
Source§

fn softline_(&self) -> DocBuilder<A>

Acts like 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>

Renders data via its Display implementation. Mirrors pretty::DocAllocator::as_string. Read more
Source§

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

Renders the provided text verbatim. Mirrors pretty::DocAllocator::text. Read more
Source§

fn concat<I>(&self, docs: I) -> DocBuilder<A>
where I::Item: ToDocumentOwned<Self, A>, I: IntoIterator,

Concatenates the given values after turning each into a document. Mirrors 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,

Concatenates documents while interspersing separator between every pair. Mirrors pretty::DocAllocator::intersperse. Read more
Source§

fn reflow(&self, text: &'static str) -> DocBuilder<A>
where A: Clone,

Reflows text, inserting softline wherever whitespace appears. Mirrors pretty::DocAllocator::reflow.
Source§

impl<P, T> Print<T> for P
where P: Printer, dyn Resugaring: for<'a> AstVisitableMut<'a, T>,

Source§

fn print_returning_fragment(&mut self, fragment: T) -> (String, SourceMap, T)
where T: ToDocument<P, Span>,

Print a single AST fragment using this backend.
Source§

fn print(&mut self, fragment: T) -> (String, SourceMap)
where T: ToDocument<P, Span>,

Print a single AST fragment using this backend.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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