pub struct RefDoc<'a, A = ()>(pub &'a Doc<'a, RefDoc<'a, A>, A>);
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<()>
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§
impl<A> Copy for RefDoc<'_, A>
Auto Trait Implementations§
impl<'a, A> Freeze for RefDoc<'a, A>
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§
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