[−][src]Enum pretty::BuildDoc
Either a Doc
or a pointer to a Doc
(D
)
Variants
Doc(Doc<'a, D, A>)
Methods
impl<'a, D, A> BuildDoc<'a, D, A> where
D: DocPtr<'a, A>,
[src]
D: DocPtr<'a, A>,
pub fn nil() -> Self
[src]
An empty document.
pub fn as_string<U: Display>(data: U) -> Self
[src]
The text t.to_string()
.
The given text must not contain line breaks.
pub fn hardline() -> Self
[src]
A single hardline.
pub fn text<U: Into<Cow<'a, str>>>(data: U) -> Self
[src]
The given text, which must not contain line breaks.
pub fn space() -> Self
[src]
pub fn fail() -> Self
[src]
impl<'a, D, A> BuildDoc<'a, D, A> where
D: StaticDoc<'a, A>,
[src]
D: StaticDoc<'a, A>,
pub fn line() -> Self
[src]
A line acts like a \n
but behaves like space
if it is grouped on a single line.
pub fn line_() -> Self
[src]
Acts like line
but behaves like nil
if grouped on a single line
Methods from Deref<Target = Doc<'a, D, A>>
pub fn render<W: ?Sized>(&self, width: usize, out: &mut W) -> Result<()> where
W: Write,
[src]
W: Write,
Writes a rendered document to a std::io::Write
object.
pub fn render_fmt<W: ?Sized>(&self, width: usize, out: &mut W) -> Result where
W: Write,
[src]
W: Write,
Writes a rendered document to a std::fmt::Write
object.
pub fn render_raw<W>(&self, width: usize, out: &mut W) -> Result<(), W::Error> where
W: RenderAnnotated<'b, A>,
W: ?Sized,
[src]
W: RenderAnnotated<'b, A>,
W: ?Sized,
Writes a rendered document to a RenderAnnotated<A>
object.
pub fn pretty<'d>(&'d self, width: usize) -> Pretty<'a, 'd, T, A>
[src]
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,
[src]
W: WriteColor,
Trait Implementations
impl<'a, D: Clone, A: Clone> Clone for BuildDoc<'a, D, A> where
D: DocPtr<'a, A>,
[src]
D: DocPtr<'a, A>,
impl<'a, D, A> Debug for BuildDoc<'a, D, A> where
D: DocPtr<'a, A> + Debug,
A: Debug,
[src]
D: DocPtr<'a, A> + Debug,
A: Debug,
impl<'a, D, A> Deref for BuildDoc<'a, D, A> where
D: DocPtr<'a, A>,
[src]
D: DocPtr<'a, A>,
type Target = Doc<'a, D, A>
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
impl<'a, A> From<BoxDoc<'a, A>> for BuildDoc<'a, BoxDoc<'a, A>, A>
[src]
impl<'a, T, A> From<Doc<'a, T, A>> for BuildDoc<'a, T, A> where
T: DocPtr<'a, A>,
[src]
T: DocPtr<'a, A>,
impl<'a, A> From<RcDoc<'a, A>> for BuildDoc<'a, RcDoc<'a, A>, A>
[src]
impl<'a, A> From<RefDoc<'a, A>> for BuildDoc<'a, RefDoc<'a, A>, A>
[src]
impl<'a, T, A, S> From<S> for BuildDoc<'a, T, A> where
T: DocPtr<'a, A>,
S: Into<Cow<'a, str>>,
[src]
T: DocPtr<'a, A>,
S: Into<Cow<'a, str>>,
impl<'a, D: ?Sized, A> Into<BuildDoc<'a, <D as DocAllocator<'a, A>>::Doc, A>> for DocBuilder<'a, D, A> where
D: DocAllocator<'a, A>,
[src]
D: DocAllocator<'a, A>,
Auto Trait Implementations
impl<'a, D, A> RefUnwindSafe for BuildDoc<'a, D, A> where
A: RefUnwindSafe,
D: RefUnwindSafe,
<D as DocPtr<'a, A>>::ColumnFn: RefUnwindSafe,
A: RefUnwindSafe,
D: RefUnwindSafe,
<D as DocPtr<'a, A>>::ColumnFn: RefUnwindSafe,
impl<'a, D, A> Send for BuildDoc<'a, D, A> where
A: Send,
D: Send,
<D as DocPtr<'a, A>>::ColumnFn: Send,
A: Send,
D: Send,
<D as DocPtr<'a, A>>::ColumnFn: Send,
impl<'a, D, A> Sync for BuildDoc<'a, D, A> where
A: Sync,
D: Sync,
<D as DocPtr<'a, A>>::ColumnFn: Sync,
A: Sync,
D: Sync,
<D as DocPtr<'a, A>>::ColumnFn: Sync,
impl<'a, D, A> Unpin for BuildDoc<'a, D, A> where
A: Unpin,
D: Unpin,
<D as DocPtr<'a, A>>::ColumnFn: Unpin,
A: Unpin,
D: Unpin,
<D as DocPtr<'a, A>>::ColumnFn: Unpin,
impl<'a, D, A> UnwindSafe for BuildDoc<'a, D, A> where
A: UnwindSafe,
D: UnwindSafe,
<D as DocPtr<'a, A>>::ColumnFn: UnwindSafe,
A: UnwindSafe,
D: UnwindSafe,
<D as DocPtr<'a, A>>::ColumnFn: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,