Expand description
Newtype wrapper for &Doc
Tuple Fields
0: &'a Doc<'a, RefDoc<'a, A>, A>
Methods from Deref<Target = Doc<'a, RefDoc<'a, A>, A>>
sourcepub fn render<W>(&self, width: usize, out: &mut W) -> Result<()> where
W: ?Sized + Write,
pub fn render<W>(&self, width: usize, out: &mut W) -> Result<()> where
W: ?Sized + Write,
Writes a rendered document to a std::io::Write
object.
sourcepub fn render_fmt<W>(&self, width: usize, out: &mut W) -> Result where
W: ?Sized + Write,
pub fn render_fmt<W>(&self, width: usize, out: &mut W) -> Result where
W: ?Sized + Write,
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>,
W: ?Sized,
pub fn render_raw<W>(&self, width: usize, out: &mut W) -> Result<(), W::Error> where
for<'b> W: RenderAnnotated<'b, A>,
W: ?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");
pub fn render_colored<W>(&self, width: usize, out: W) -> Result<()> where
W: WriteColor,
Trait Implementations
sourceimpl<'a, A> Pretty<'a, Arena<'a, A>, A> for RefDoc<'a, A> where
A: 'a,
impl<'a, A> Pretty<'a, Arena<'a, A>, A> for RefDoc<'a, A> where
A: 'a,
sourcefn pretty(self, allocator: &'a Arena<'a, A>) -> DocBuilder<'a, Arena<'a, A>, A>
fn pretty(self, allocator: &'a Arena<'a, A>) -> DocBuilder<'a, Arena<'a, A>, A>
Converts self
into a document
impl<A> Copy for RefDoc<'_, A>
Auto Trait Implementations
impl<'a, A = ()> !RefUnwindSafe for RefDoc<'a, A>
impl<'a, A = ()> !Send for RefDoc<'a, A>
impl<'a, A = ()> !Sync for RefDoc<'a, A>
impl<'a, A> Unpin for RefDoc<'a, A>
impl<'a, A = ()> !UnwindSafe for RefDoc<'a, A>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more