pub enum Doc {
Nil,
Text(String),
Line,
HardLine,
Concat(Vec<Doc>),
Nest(i32, Box<Doc>),
Group(Box<Doc>),
}Expand description
Wadler-Lindig pretty-printing combinators.
A Doc describes a document that can be rendered at a given line width.
Group(d) attempts to render d on a single line; if it doesn’t fit
within the remaining width the group “breaks” and any Line inside
becomes a newline followed by the current indentation.
Variants§
Nil
Text(String)
Line
Soft line: a space when the enclosing group is flat, a newline + indentation when it is broken.
HardLine
Hard line: always a newline + indentation regardless of group mode.
Concat(Vec<Doc>)
Nest(i32, Box<Doc>)
Increase indentation for the inner document by n spaces.
Group(Box<Doc>)
Try to render the inner document flat; break if it exceeds the width.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Doc
impl RefUnwindSafe for Doc
impl Send for Doc
impl Sync for Doc
impl Unpin for Doc
impl UnsafeUnpin for Doc
impl UnwindSafe for Doc
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