multisize_string

Function multisize_string 

Source
pub fn multisize_string<S>(
    strings: impl IntoIterator<Item = S>,
    max_size: usize,
) -> S
where S: Borrow<str>,
Expand description

Returns the first string that fits within max_size width.

Returns the last string if none fits. So it’s NOT guaranteed that the returned string fits. It’s up to the caller to handle this case. Perhaps by trimming the string (trim_center).

§Panics

Panics if the iterator is empty.