Returns whether `self` has a prefix of `other.` Note that `Pointer::root` is a valid prefix of any `Pointer` (including itself).
(&self, other: &Self)
| 289 | /// Note that `Pointer::root` is a valid prefix of any `Pointer` (including |
| 290 | /// itself). |
| 291 | pub fn starts_with(&self, other: &Self) -> bool { |
| 292 | self.as_str().starts_with(&other.0) |
| 293 | // ensure we end at a token boundary |
| 294 | && (other.len() == self.len() || self.0.as_bytes()[other.len()] == b'/') |
| 295 | } |
| 296 | |
| 297 | /// Attempts to get a `Token` by the index. Returns `None` if the index is |
| 298 | /// out of bounds. |