pub enum BuildDoc<'a, D, A>where
D: DocPtr<'a, A>,{
DocPtr(D),
Doc(Doc<'a, D, A>),
}
Expand description
Either a Doc
or a pointer to a Doc
(D
)
Variants§
Implementations§
Methods from Deref<Target = Doc<'a, D, A>>§
Sourcepub fn render<W>(&self, width: usize, out: &mut W) -> Result<()>
pub fn render<W>(&self, width: usize, out: &mut W) -> Result<()>
Writes a rendered document to a std::io::Write
object.
Sourcepub fn render_fmt<W>(&self, width: usize, out: &mut W) -> Result
pub fn render_fmt<W>(&self, width: usize, out: &mut W) -> Result
Writes a rendered document to a std::fmt::Write
object.
Sourcepub fn render_raw<W>(&self, width: usize, out: &mut W) -> Result<(), W::Error>where
for<'b> W: RenderAnnotated<'b, A> + ?Sized,
pub fn render_raw<W>(&self, width: usize, out: &mut W) -> Result<(), W::Error>where
for<'b> W: RenderAnnotated<'b, A> + ?Sized,
Writes a rendered document to a RenderAnnotated<A>
object.
Sourcepub fn pretty<'d>(&'d self, width: usize) -> PrettyFmt<'a, 'd, T, A>
pub fn pretty<'d>(&'d self, width: usize) -> PrettyFmt<'a, 'd, T, A>
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§
Source§impl<'a, D, A> From<DocBuilder<'a, D, A>> for BuildDoc<'a, D::Doc, A>where
D: ?Sized + DocAllocator<'a, A>,
impl<'a, D, A> From<DocBuilder<'a, D, A>> for BuildDoc<'a, D::Doc, A>where
D: ?Sized + DocAllocator<'a, A>,
Source§fn from(val: DocBuilder<'a, D, A>) -> Self
fn from(val: DocBuilder<'a, D, A>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<'a, D, A> Freeze for BuildDoc<'a, D, A>
impl<'a, D, A> RefUnwindSafe for BuildDoc<'a, D, A>
impl<'a, D, A> Send for BuildDoc<'a, D, A>
impl<'a, D, A> Sync for BuildDoc<'a, D, A>
impl<'a, D, A> Unpin for BuildDoc<'a, D, A>
impl<'a, D, A> UnwindSafe for BuildDoc<'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
)