Function textwrap::fill [] [src]

pub fn fill(s: &str, width: usize) -> String

Fill a line of text at width bytes.

The result is a string with newlines between each line. Use wrap if you need access to the individual lines.

use textwrap::fill;

assert_eq!(fill("Memory safety without garbage collection.", 15),
           "Memory safety\nwithout garbage\ncollection.");

This function creates a Wrapper on the fly. If you need to wrap many strings, it can be more efficient to create a single Wrapper and call its fill method.