Struct pretty::DocBuilder [−][src]
pub struct DocBuilder<'a, D: ?Sized, A = ()>(pub &'a D, pub Doc<'a, D::Doc, A>)
where
D: DocAllocator<'a, A> + 'a;
The DocBuilder
type allows for convenient appending of documents even for arena allocated
documents by storing the arena inline.
Methods
impl<'a, 's, D: ?Sized, A> DocBuilder<'a, D, A> where
D: DocAllocator<'a, A>,
[src]
impl<'a, 's, D: ?Sized, A> DocBuilder<'a, D, A> where
D: DocAllocator<'a, A>,
pub fn append<E>(self, that: E) -> DocBuilder<'a, D, A> where
E: Into<Doc<'a, D::Doc, A>>,
[src]
pub fn append<E>(self, that: E) -> DocBuilder<'a, D, A> where
E: Into<Doc<'a, D::Doc, A>>,
Append the given document after this document.
pub fn group(self) -> DocBuilder<'a, D, A>
[src]
pub fn group(self) -> DocBuilder<'a, D, A>
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.
pub fn nest(self, offset: usize) -> DocBuilder<'a, D, A>
[src]
pub fn nest(self, offset: usize) -> DocBuilder<'a, D, A>
Increase the indentation level of this document.
pub fn annotate(self, ann: A) -> DocBuilder<'a, D, A>
[src]
pub fn annotate(self, ann: A) -> DocBuilder<'a, D, A>
Trait Implementations
impl<'a, D: Eq + ?Sized, A: Eq> Eq for DocBuilder<'a, D, A> where
D: DocAllocator<'a, A> + 'a,
D::Doc: Eq,
[src]
impl<'a, D: Eq + ?Sized, A: Eq> Eq for DocBuilder<'a, D, A> where
D: DocAllocator<'a, A> + 'a,
D::Doc: Eq,
impl<'a, D: Ord + ?Sized, A: Ord> Ord for DocBuilder<'a, D, A> where
D: DocAllocator<'a, A> + 'a,
D::Doc: Ord,
[src]
impl<'a, D: Ord + ?Sized, A: Ord> Ord for DocBuilder<'a, D, A> where
D: DocAllocator<'a, A> + 'a,
D::Doc: Ord,
fn cmp(&self, other: &DocBuilder<'a, D, A>) -> Ordering
[src]
fn cmp(&self, other: &DocBuilder<'a, D, A>) -> 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, D: PartialEq + ?Sized, A: PartialEq> PartialEq for DocBuilder<'a, D, A> where
D: DocAllocator<'a, A> + 'a,
D::Doc: PartialEq,
[src]
impl<'a, D: PartialEq + ?Sized, A: PartialEq> PartialEq for DocBuilder<'a, D, A> where
D: DocAllocator<'a, A> + 'a,
D::Doc: PartialEq,
fn eq(&self, other: &DocBuilder<'a, D, A>) -> bool
[src]
fn eq(&self, other: &DocBuilder<'a, D, A>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &DocBuilder<'a, D, A>) -> bool
[src]
fn ne(&self, other: &DocBuilder<'a, D, A>) -> bool
This method tests for !=
.
impl<'a, D: PartialOrd + ?Sized, A: PartialOrd> PartialOrd for DocBuilder<'a, D, A> where
D: DocAllocator<'a, A> + 'a,
D::Doc: PartialOrd,
[src]
impl<'a, D: PartialOrd + ?Sized, A: PartialOrd> PartialOrd for DocBuilder<'a, D, A> where
D: DocAllocator<'a, A> + 'a,
D::Doc: PartialOrd,
fn partial_cmp(&self, other: &DocBuilder<'a, D, A>) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &DocBuilder<'a, D, A>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &DocBuilder<'a, D, A>) -> bool
[src]
fn lt(&self, other: &DocBuilder<'a, D, A>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &DocBuilder<'a, D, A>) -> bool
[src]
fn le(&self, other: &DocBuilder<'a, D, A>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &DocBuilder<'a, D, A>) -> bool
[src]
fn gt(&self, other: &DocBuilder<'a, D, A>) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &DocBuilder<'a, D, A>) -> bool
[src]
fn ge(&self, other: &DocBuilder<'a, D, A>) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<'a, A, D> Clone for DocBuilder<'a, D, A> where
A: Clone,
D: DocAllocator<'a, A> + 'a,
D::Doc: Clone,
[src]
impl<'a, A, D> Clone for DocBuilder<'a, D, A> where
A: Clone,
D: DocAllocator<'a, A> + 'a,
D::Doc: Clone,
fn clone(&self) -> Self
[src]
fn clone(&self) -> Self
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, D: ?Sized, A> Into<Doc<'a, D::Doc, A>> for DocBuilder<'a, D, A> where
D: DocAllocator<'a, A>,
[src]
impl<'a, D: ?Sized, A> Into<Doc<'a, D::Doc, A>> for DocBuilder<'a, D, A> where
D: DocAllocator<'a, A>,
Auto Trait Implementations
impl<'a, D: ?Sized, A> Send for DocBuilder<'a, D, A> where
A: Send,
D: Sync,
<D as DocAllocator<'a, A>>::Doc: Send,
impl<'a, D: ?Sized, A> Send for DocBuilder<'a, D, A> where
A: Send,
D: Sync,
<D as DocAllocator<'a, A>>::Doc: Send,
impl<'a, D: ?Sized, A> Sync for DocBuilder<'a, D, A> where
A: Sync,
D: Sync,
<D as DocAllocator<'a, A>>::Doc: Sync,
impl<'a, D: ?Sized, A> Sync for DocBuilder<'a, D, A> where
A: Sync,
D: Sync,
<D as DocAllocator<'a, A>>::Doc: Sync,