(&self, maxsplit: isize, convert: F)
| 2261 | } |
| 2262 | |
| 2263 | fn py_split_whitespace<F>(&self, maxsplit: isize, convert: F) -> Vec<PyObjectRef> |
| 2264 | where |
| 2265 | F: Fn(&Self) -> PyObjectRef, |
| 2266 | { |
| 2267 | // CPython split_whitespace |
| 2268 | let mut splits = Vec::new(); |
| 2269 | let mut last_offset = 0; |
| 2270 | let mut count = maxsplit; |
| 2271 | for (offset, _) in self.match_indices(|c: char| c.is_ascii_whitespace() || c == '\x0b') { |
| 2272 | if last_offset == offset { |
| 2273 | last_offset += 1; |
| 2274 | continue; |
| 2275 | } |
| 2276 | if count == 0 { |
| 2277 | break; |
| 2278 | } |
| 2279 | splits.push(convert(&self[last_offset..offset])); |
| 2280 | last_offset = offset + 1; |
| 2281 | count -= 1; |
| 2282 | } |
| 2283 | if last_offset != self.len() { |
| 2284 | splits.push(convert(&self[last_offset..])); |
| 2285 | } |
| 2286 | splits |
| 2287 | } |
| 2288 | |
| 2289 | fn py_rsplit_whitespace<F>(&self, maxsplit: isize, convert: F) -> Vec<PyObjectRef> |
| 2290 | where |
no test coverage detected