pub struct PrettyProvider<'a> { /* private fields */ }

Implementations§

source§

impl<'a> PrettyProvider<'a>

source

pub fn new() -> Self

source§

impl<'a> PrettyProvider<'a>where 'a: 'static,

source

pub fn nil(&'a self) -> PrettyTree<'a>

source

pub fn space(&'a self) -> PrettyTree<'a>

source

pub fn hardline(&'a self) -> PrettyTree<'a>

source

pub fn text<S>(&'a self, text: S) -> PrettyTree<'a>where S: Into<Cow<'static, str>>,

source

pub fn keyword<S>(&'a self, text: S) -> PrettyTree<'a>where S: Into<Cow<'static, str>>,

source

pub fn identifier<S>(&'a self, text: S) -> PrettyTree<'a>where S: Into<Cow<'static, str>>,

source

pub fn generic<S>(&'a self, text: S) -> PrettyTree<'a>where S: Into<Cow<'static, str>>,

source

pub fn argument<S>(&'a self, text: S) -> PrettyTree<'a>where S: Into<Cow<'static, str>>,

source

pub fn operator<S>(&'a self, text: S) -> PrettyTree<'a>where S: Into<Cow<'static, str>>,

source

pub fn string_style(&self) -> ColorSpec

source

pub fn number_style(&self) -> ColorSpec

source

pub fn macro_style(&self) -> ColorSpec

source§

impl<'a> PrettyProvider<'a>

source

pub fn concat<I>(&'a self, docs: I) -> PrettyTree<'a>where I: IntoIterator, I::Item: Pretty<'a, Arena<'a, ColorSpec>, ColorSpec>,

Allocate a document concatenating the given documents.

source

pub fn intersperse<T, S>(&'a self, terms: &[T], joint: S) -> PrettyTree<'a>where T: PrettyPrint, S: Pretty<'a, Arena<'a, ColorSpec>, ColorSpec> + 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].

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

source

pub fn join<T, S>(&'a self, terms: &[T], joint: &'static str) -> PrettyTree<'a>where T: PrettyPrint, S: Pretty<'a, Arena<'a, ColorSpec>, ColorSpec> + 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].

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

Trait Implementations§

source§

impl<'a> Debug for PrettyProvider<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for PrettyProvider<'a>

§

impl<'a> !Send for PrettyProvider<'a>

§

impl<'a> !Sync for PrettyProvider<'a>

§

impl<'a> Unpin for PrettyProvider<'a>

§

impl<'a> !UnwindSafe for PrettyProvider<'a>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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, U> Into<U> for Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.