pub enum Doc<'a, T, A = ()>where
T: DocPtr<'a, A>,{
}Expand description
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 T parameter is used to abstract over pointers to Doc. See RefDoc and BoxDoc for how
it is used
Variants§
Nil
Append(T, T)
Group(T)
FlatAlt(T, T)
Nest(isize, T)
Hardline
RenderLen(usize, T)
OwnedText(Box<str>)
BorrowedText(&'a str)
SmallText(SmallText)
Annotated(A, T)
Union(T, T)
Column(T::ColumnFn)
Nesting(T::ColumnFn)
Fail
Implementations§
Source§impl<'a, T, A> Doc<'a, T, A>where
T: DocPtr<'a, A> + 'a,
impl<'a, T, A> Doc<'a, T, A>where
T: DocPtr<'a, A> + '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§
Auto Trait Implementations§
impl<'a, T, A> Freeze for Doc<'a, T, A>
impl<'a, T, A> RefUnwindSafe for Doc<'a, T, A>
impl<'a, T, A> Send for Doc<'a, T, A>
impl<'a, T, A> Sync for Doc<'a, T, A>
impl<'a, T, A> Unpin for Doc<'a, T, A>
impl<'a, T, A> UnwindSafe for Doc<'a, T, 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