Function textwrap::refill[][src]

pub fn refill<'a, S, Opt>(
    filled_text: &str,
    new_width_or_options: Opt
) -> String where
    S: WordSplitter,
    Opt: Into<Options<'a, S>>, 

Refill a paragraph of wrapped text with a new width.

This function will first use the unfill function to remove newlines from the text. Afterwards the text is filled again using the fill function.

The new_width_or_options argument specify the new width and can specify other options as well — except for Options::initial_indent and Options::subsequent_indent, which are deduced from filled_text.


use textwrap::refill;

let text = "\
> Memory safety without
> garbage collection.
assert_eq!(refill(text, 15), "\
> Memory safety
> without
> garbage
> collection.