pub struct DocBuilder<'a, D, A = ()>(pub &'a D, pub Doc<'a, D::Doc, A>)
where
D: ?Sized + DocAllocator<'a, A> + 'a;
Expand description
The DocBuilder
type allows for convenient appending of documents even for arena allocated
documents by storing the arena inline.
Tuple Fields§
§0: &'a D
§1: Doc<'a, D::Doc, A>
Implementations§
Source§impl<'a, 's, D, A> DocBuilder<'a, D, A>where
D: ?Sized + DocAllocator<'a, A>,
impl<'a, 's, D, A> DocBuilder<'a, D, A>where
D: ?Sized + DocAllocator<'a, A>,
Sourcepub fn append<E>(self, that: E) -> DocBuilder<'a, D, A>
pub fn append<E>(self, that: E) -> DocBuilder<'a, D, A>
Append the given document after this document.
Sourcepub fn group(self) -> DocBuilder<'a, D, A>
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.
Sourcepub fn nest(self, offset: usize) -> DocBuilder<'a, D, A>
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>
Trait Implementations§
Source§impl<'a, A, D> Clone for DocBuilder<'a, D, A>
impl<'a, A, D> Clone for DocBuilder<'a, D, A>
Source§impl<'a, D, A> Into<Doc<'a, <D as DocAllocator<'a, A>>::Doc, A>> for DocBuilder<'a, D, A>where
D: ?Sized + DocAllocator<'a, A>,
impl<'a, D, A> Into<Doc<'a, <D as DocAllocator<'a, A>>::Doc, A>> for DocBuilder<'a, D, A>where
D: ?Sized + DocAllocator<'a, A>,
Source§impl<'a, D, A: Ord> Ord for DocBuilder<'a, D, A>
impl<'a, D, A: Ord> Ord for DocBuilder<'a, D, A>
Source§fn cmp(&self, other: &DocBuilder<'a, D, A>) -> Ordering
fn cmp(&self, other: &DocBuilder<'a, D, A>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<'a, D, A: PartialEq> PartialEq for DocBuilder<'a, D, A>
impl<'a, D, A: PartialEq> PartialEq for DocBuilder<'a, D, A>
Source§impl<'a, D, A: PartialOrd> PartialOrd for DocBuilder<'a, D, A>
impl<'a, D, A: PartialOrd> PartialOrd for DocBuilder<'a, D, A>
impl<'a, D, A: Eq> Eq for DocBuilder<'a, D, A>
impl<'a, D, A> StructuralPartialEq for DocBuilder<'a, D, A>where
D: ?Sized + DocAllocator<'a, A> + 'a,
Auto Trait Implementations§
impl<'a, D, A> Freeze for DocBuilder<'a, D, A>
impl<'a, D, A> RefUnwindSafe for DocBuilder<'a, D, A>
impl<'a, D, A> Send for DocBuilder<'a, D, A>
impl<'a, D, A> Sync for DocBuilder<'a, D, A>
impl<'a, D, A> Unpin for DocBuilder<'a, D, A>
impl<'a, D, A> UnwindSafe for DocBuilder<'a, D, A>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)