Trait array_tool::string::WordWrap [] [src]

pub trait WordWrap {
    fn word_wrap(&self, width: usize) -> String;
}

Word wrapping

Required Methods

White space is treated as valid content and new lines will only be swapped in for the last white space character at the end of the given width. White space may reach beyond the width you've provided. You will need to trim end of lines in your own output (e.g. splitting string at each new line and printing the line with trim_right). Or just trust that lines that are beyond the width are just white space and only print the width - ignoring tailing white space.

Example

use array_tool::string::WordWrap;

"asd asdf asd".word_wrap(8);

Output

"asd asdf\nasd"

Implementations on Foreign Types

impl WordWrap for &'static str
[src]

[src]

Implementors