to_string

Function to_string 

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

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.