[][src]Function places::util::slice_up_to

pub fn slice_up_to(s: &str, max_len: usize) -> &str

Equivalent to &s[..max_len.min(s.len())], but handles the case where s.is_char_boundary(max_len) is false (which would otherwise panic).