Enum pretty::Doc
[−]
[src]
pub enum Doc<'a, B> { Nil, Append(B, B), Group(B), Nest(usize, B), Space, Newline, Text(Cow<'a, str>), }
The concrete document type. This type is not meant to be used directly. Instead use the static
functions on Doc
or the methods on an DocAllocator
.
The B
parameter is used to abstract over pointers to Doc
. See RefDoc
and BoxDoc
for how
it is used
Variants
Nil
Append(B, B)
Group(B)
Nest(usize, B)
Space
Newline
Text(Cow<'a, str>)
Methods
impl<'a, B> Doc<'a, B>
[src]
impl<'a, B> Doc<'a, B>
pub fn render<'b, W: ?Sized + Write>(
&'b self,
width: usize,
out: &mut W
) -> Result<()> where
B: Deref<Target = Doc<'b, B>>,
[src]
pub fn render<'b, W: ?Sized + Write>(
&'b self,
width: usize,
out: &mut W
) -> Result<()> where
B: Deref<Target = Doc<'b, B>>,
Writes a rendered document.
impl<'a, B> Doc<'a, B>
[src]
impl<'a, B> Doc<'a, B>
pub fn nil() -> Doc<'a, B>
[src]
pub fn nil() -> Doc<'a, B>
pub fn as_string<T: ToString>(t: T) -> Doc<'a, B>
[src]
pub fn as_string<T: ToString>(t: T) -> Doc<'a, B>
pub fn newline() -> Doc<'a, B>
[src]
pub fn newline() -> Doc<'a, B>
pub fn text<T: Into<Cow<'a, str>>>(data: T) -> Doc<'a, B>
[src]
pub fn text<T: Into<Cow<'a, str>>>(data: T) -> Doc<'a, B>
pub fn space() -> Doc<'a, B>
[src]
pub fn space() -> Doc<'a, B>
impl<'a> Doc<'a, BoxDoc<'a>>
[src]
impl<'a> Doc<'a, BoxDoc<'a>>
pub fn append(self, that: Doc<'a, BoxDoc<'a>>) -> Doc<'a, BoxDoc<'a>>
[src]
pub fn append(self, that: Doc<'a, BoxDoc<'a>>) -> Doc<'a, BoxDoc<'a>>
pub fn concat<I>(&'a self, docs: I) -> Doc<'a, BoxDoc<'a>> where
I: IntoIterator<Item = Doc<'a, BoxDoc<'a>>>,
[src]
pub fn concat<I>(&'a self, docs: I) -> Doc<'a, BoxDoc<'a>> where
I: IntoIterator<Item = Doc<'a, BoxDoc<'a>>>,
pub fn group(self) -> Doc<'a, BoxDoc<'a>>
[src]
pub fn group(self) -> Doc<'a, BoxDoc<'a>>
pub fn nest(self, offset: usize) -> Doc<'a, BoxDoc<'a>>
[src]
pub fn nest(self, offset: usize) -> Doc<'a, BoxDoc<'a>>
Trait Implementations
impl<'a, B: Clone> Clone for Doc<'a, B>
[src]
impl<'a, B: Clone> Clone for Doc<'a, B>
fn clone(&self) -> Doc<'a, B>
[src]
fn clone(&self) -> Doc<'a, B>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<'a, B: Debug> Debug for Doc<'a, B>
[src]
impl<'a, B: Debug> Debug for Doc<'a, B>
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<'a, B: Eq> Eq for Doc<'a, B>
[src]
impl<'a, B: Eq> Eq for Doc<'a, B>
impl<'a, B: Ord> Ord for Doc<'a, B>
[src]
impl<'a, B: Ord> Ord for Doc<'a, B>
fn cmp(&self, __arg_0: &Doc<'a, B>) -> Ordering
[src]
fn cmp(&self, __arg_0: &Doc<'a, B>) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl<'a, B: PartialEq> PartialEq for Doc<'a, B>
[src]
impl<'a, B: PartialEq> PartialEq for Doc<'a, B>
fn eq(&self, __arg_0: &Doc<'a, B>) -> bool
[src]
fn eq(&self, __arg_0: &Doc<'a, B>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Doc<'a, B>) -> bool
[src]
fn ne(&self, __arg_0: &Doc<'a, B>) -> bool
This method tests for !=
.
impl<'a, B: PartialOrd> PartialOrd for Doc<'a, B>
[src]
impl<'a, B: PartialOrd> PartialOrd for Doc<'a, B>
fn partial_cmp(&self, __arg_0: &Doc<'a, B>) -> Option<Ordering>
[src]
fn partial_cmp(&self, __arg_0: &Doc<'a, B>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &Doc<'a, B>) -> bool
[src]
fn lt(&self, __arg_0: &Doc<'a, B>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &Doc<'a, B>) -> bool
[src]
fn le(&self, __arg_0: &Doc<'a, B>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &Doc<'a, B>) -> bool
[src]
fn gt(&self, __arg_0: &Doc<'a, B>) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &Doc<'a, B>) -> bool
[src]
fn ge(&self, __arg_0: &Doc<'a, B>) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<'a, B, S> From<S> for Doc<'a, B> where
S: Into<Cow<'a, str>>,
[src]
impl<'a, B, S> From<S> for Doc<'a, B> where
S: Into<Cow<'a, str>>,
impl<'a, A: ?Sized> Into<Doc<'a, A::Doc>> for DocBuilder<'a, A> where
A: DocAllocator<'a>,
[src]
impl<'a, A: ?Sized> Into<Doc<'a, A::Doc>> for DocBuilder<'a, A> where
A: DocAllocator<'a>,