Macro textwrap_macros::fill[][src]

macro_rules! fill {
    #[proc_macro_hack::proc_macro_hack] => { ... };
}

Fill a line of text at width characters.

Strings are wrapped based on their displayed width, not their size in bytes. The result is a string with newlines between each line. Use wrap if you need access to the individual lines.

Usage

fill!($text: lit &str, $width: lit usize) -> lit &str

Example

use textwrap_macros::fill;

const FILLED: &str = fill!("Memory safety without garbage collection.", 15);
assert_eq!(FILLED, "Memory safety\nwithout garbage\ncollection.");

See also textwrap::fill.