This is the most direct implementation of the concept of "count the number of bytes in the string which are not continuation bytes", and is used for the head and tail of the input string (the first and last item in the tuple returned by `slice::align_to`).
(s: &[u8])
| 116 | // head and tail of the input string (the first and last item in the tuple |
| 117 | // returned by `slice::align_to`). |
| 118 | fn char_count_general_case(s: &[u8]) -> usize { |
| 119 | s.iter() |
| 120 | .filter(|&&byte| !super::core_str::utf8_is_cont_byte(byte)) |
| 121 | .count() |
| 122 | } |
| 123 | |
| 124 | // polyfills of unstable library features |
| 125 |
no test coverage detected