wrap_bytes

Function wrap_bytes 

Source
pub fn wrap_bytes(text: &[u8], width: usize) -> Vec<&[u8]>
Expand description

Wraps lines at the given width, returns a vector of lines (excluding “\n”.)

Existing newline characters will never be removed. For str content, you can use textwrap::refill() to refill a pre-formatted text.

Each line is a sub-slice of the given text, even if the line is empty.

The wrapping logic is more restricted than the default of the textwrap. Notably, this doesn’t support hyphenation nor unicode line break. The display width is calculated based on unicode property in the same manner as textwrap::wrap().