Function pretty_trait::to_string [] [src]

pub fn to_string<T: Pretty>(
    content: &T,
    max_line: Option<usize>,
    tab_size: usize
) -> String

Render a pretty-printable value to an owned string and return it.

If you just want to write a value to standard output, you probably want one of the more efficient println_simple or write functions instead.

Panics

Because Pretty is defined in terms of writing to an io::Write handle, not a string, there is no guarantee that rendering a Pretty type will produce valid UTF-8. None of the built-in types in the pretty-trait crate will produce invalid UTF-8, but if a custom Pretty type generates invalid UTF-8 then this function will panic.