Struct pretty::RcDoc[][src]

pub struct RcDoc<'a, A = ()>(_);

Implementations

An empty document.

A single hardline.

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

Acts like line but behaves like nil if grouped on a single line

The text t.to_string().

The given text must not contain line breaks.

The given text, which must not contain line breaks.

Append the given document after this document.

A single document concatenating all the given documents.

A single document interspersing the given separator S between the given documents. For example, if the documents are [A, B, C, ..., Z], this yields [A, S, B, S, C, S, ..., S, Z].

Compare the intersperse method from the itertools crate.

NOTE: The separator type, S may need to be cloned. Consider using cheaply cloneable ptr like RefDoc or RcDoc

Acts as self when laid out on multiple lines and acts as that when laid out on a single line.

Mark this document as a group.

Groups are layed out on a single line if possible. Within a group, all basic documents with several possible layouts are assigned the same layout, that is, they are all layed out horizontally and combined into a one single line, or they are each layed out on their own line.

Increase the indentation level of this document.

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

Methods from Deref<Target = Doc<'a, RcDoc<'a, A>, A>>

Writes a rendered document to a std::io::Write object.

Writes a rendered document to a std::fmt::Write object.

Writes a rendered document to a RenderAnnotated<A> object.

Returns a value which implements std::fmt::Display

use pretty::{Doc, BoxDoc};
let doc = BoxDoc::<()>::group(
    BoxDoc::text("hello").append(Doc::line()).append(Doc::text("world"))
);
assert_eq!(format!("{}", doc.pretty(80)), "hello world");

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Performs the conversion.

Performs the conversion.

Converts self into a document

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.