Function difft::display::style::split_string_by_width
source · fn split_string_by_width(
s: &str,
max_width: usize,
tab_width: usize
) -> Vec<(&str, usize)>
Expand description
Split a string into parts whose display length does not
exceed max_width
.
If any part has a display width less than max_width
, also
specify the number of spaces required to pad the part to reach the
desired width.
split_string_by_width("fooba", 3) // vec![("foo", 0), ("ba", 1)]