(&self, start: usize, end: usize)
| 192 | } |
| 193 | |
| 194 | pub fn slice_text(&self, start: usize, end: usize) -> String { |
| 195 | let start = start.min(self.len_chars()); |
| 196 | let end = end.min(self.len_chars()); |
| 197 | if start >= end { |
| 198 | return String::new(); |
| 199 | } |
| 200 | |
| 201 | let slice = self.rope.slice(start..end); |
| 202 | let mut text = String::with_capacity(slice.len_bytes()); |
| 203 | for chunk in slice.chunks() { |
| 204 | text.push_str(chunk); |
| 205 | } |
| 206 | text |
| 207 | } |
| 208 | |
| 209 | pub fn slice(&self, start: usize, end: usize) -> Option<RopeSlice<'_>> { |
| 210 | let start = start.min(self.len_chars()); |
no test coverage detected