Struct sparkly::Doc
[−]
[src]
pub struct Doc { /* fields omitted */ }The type of pretty-printed text.
Methods
impl Doc[src]
fn empty() -> Doc[src]
Returns an empty Doc.
fn line() -> Doc[src]
Expands to a newline, which will never be shortened.
fn line_or(s: &'static str) -> Doc[src]
Expands to the given string, if it will fit, or a newline if it won't.
fn lines<I: IntoIterator<Item = T>, T: Sparkly>(iter: I) -> Doc[src]
Concatenates Docs, putting newlines between them.
fn nbsp() -> Doc[src]
Returns a Doc that always expands to a space.
fn space() -> Doc[src]
Returns a Doc that expands to a space if it will fit, or a newline
if it won't.
fn split_point() -> Doc[src]
Returns a Doc that represents a point where a line may be split if
needed.
fn text<T: ToString>(t: T, sty: Style) -> Doc[src]
Constructs a Doc containing the given text with the given style.
impl Doc[src]
fn append(self, right: Doc) -> Doc[src]
Appends one Doc to another.
fn bracket(self, l: &'static str, r: &'static str) -> Doc[src]
Brackets a Doc between two constant strings.
fn group(self) -> Doc[src]
Groups the contents of a Doc.
fn join<I: IntoIterator<Item = T>, T: Sparkly>(self, iter: I) -> Doc[src]
Joins Docs, placing the self Doc between them.
fn nest(self, n: usize) -> Doc[src]
Nests the Doc with the given amount of indentation.
fn style(self, style: Style) -> Doc[src]
Applies a style to a Doc.
impl Doc[src]
fn display(&self) -> Display[src]
Returns an object that implements Display for the current size of the
terminal, or 80 columns wide if it cannot be detected. Color is enabled
if stdout is a TTY.
Terminal width detection requires the termion feature.
fn display_opts(&self, width: usize, color: bool) -> Display[src]
Returns an object that implements Display for the given options.
Trait Implementations
impl From<&'static str> for Doc[src]
impl From<String> for Doc[src]
impl FromIterator<Doc> for Doc[src]
fn from_iter<T: IntoIterator<Item = Doc>>(iter: T) -> Doc[src]
Creates a value from an iterator. Read more
impl Clone for Doc[src]
fn clone(&self) -> Doc[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl Debug for Doc[src]
impl PartialEq for Doc[src]
fn eq(&self, __arg_0: &Doc) -> bool[src]
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &Doc) -> bool[src]
This method tests for !=.