(&self, range: Range<usize>)
| 1813 | } |
| 1814 | |
| 1815 | fn do_slice(&self, range: Range<usize>) -> Self::Sliced { |
| 1816 | match self.as_str_kind() { |
| 1817 | PyKindStr::Ascii(s) => s[range].into(), |
| 1818 | PyKindStr::Utf8(s) => { |
| 1819 | let char_len = range.len(); |
| 1820 | let out = rustpython_common::str::get_chars(s, range); |
| 1821 | // SAFETY: char_len is accurate |
| 1822 | unsafe { Self::new_with_char_len(out, char_len) } |
| 1823 | } |
| 1824 | PyKindStr::Wtf8(w) => { |
| 1825 | let char_len = range.len(); |
| 1826 | let out = rustpython_common::str::get_codepoints(w, range); |
| 1827 | // SAFETY: char_len is accurate |
| 1828 | unsafe { Self::new_with_char_len(out, char_len) } |
| 1829 | } |
| 1830 | } |
| 1831 | } |
| 1832 | |
| 1833 | fn do_slice_reverse(&self, range: Range<usize>) -> Self::Sliced { |
| 1834 | match self.as_str_kind() { |
nothing calls this directly
no test coverage detected