Splits the `Pointer` into the parent path and the last `Token`.
(&self)
| 240 | |
| 241 | /// Splits the `Pointer` into the parent path and the last `Token`. |
| 242 | pub fn split_back(&self) -> Option<(&Self, Token)> { |
| 243 | self.0.rsplit_once('/').map(|(front, back)| { |
| 244 | ( |
| 245 | // SAFETY: we split at a token boundary, so front is a valid pointer |
| 246 | unsafe { Self::new_unchecked(front) }, |
| 247 | // SAFETY: source token is encoded |
| 248 | unsafe { Token::from_encoded_unchecked(back) }, |
| 249 | ) |
| 250 | }) |
| 251 | } |
| 252 | |
| 253 | /// A pointer to the parent of the current path. |
| 254 | pub fn parent(&self) -> Option<&Self> { |