1 pub trait _StrExt { _is_char_boundary(&self, index: usize) -> bool2 fn _is_char_boundary(&self, index: usize) -> bool; 3 } 4 5 impl _StrExt for str { 6 #[inline] _is_char_boundary(&self, index: usize) -> bool7 fn _is_char_boundary(&self, index: usize) -> bool { 8 if index == self.len() { 9 return true; 10 } 11 match self.as_bytes().get(index) { 12 None => false, 13 Some(&b) => b < 128 || b >= 192, 14 } 15 } 16 } 17