Macro textwrap_macros::wrap

source ·
macro_rules! wrap {
    ($($proc_macro:tt)*) => { ... };
}
Expand description

Wrap a line of text at width characters.

Strings are wrapped based on their displayed width, not their size in bytes.

Usage

wrap!($text: lit &str, $width: lit usize) -> lit &[ lit &str ]

Example

use textwrap_macros::wrap;

const LINES: &[&str] = wrap!("Concurrency without data races.", 15);
assert_eq!(LINES, ["Concurrency", "without data", "races."]);