Splits the `Pointer` at the given index if the character at the index is a separator slash (`'/'`), returning `Some((head, tail))`. Otherwise, returns `None`. For the following JSON Pointer, the following splits are possible (0, 4, 8): ```text /foo/bar/baz ↑ ↑ ↑ 0 4 8 ``` All other indices will return `None`. ## Example ```rust # use jsonptr::Pointer; let ptr = Pointer::from_static("/fo
(&self, offset: usize)
| 230 | /// assert_eq!(ptr.split_at(3), None); |
| 231 | /// ``` |
| 232 | pub fn split_at(&self, offset: usize) -> Option<(&Self, &Self)> { |
| 233 | if self.0.as_bytes().get(offset).copied() != Some(b'/') { |
| 234 | return None; |
| 235 | } |
| 236 | let (head, tail) = self.0.split_at(offset); |
| 237 | // SAFETY: we split at a token boundary, so head and tail are valid pointers |
| 238 | unsafe { Some((Self::new_unchecked(head), Self::new_unchecked(tail))) } |
| 239 | } |
| 240 | |
| 241 | /// Splits the `Pointer` into the parent path and the last `Token`. |
| 242 | pub fn split_back(&self) -> Option<(&Self, Token)> { |
no test coverage detected