MCPcopy Create free account
hub / github.com/chanced/jsonptr / starts_with

Method starts_with

src/pointer.rs:291–295  ·  view source on GitHub ↗

Returns whether `self` has a prefix of `other.` Note that `Pointer::root` is a valid prefix of any `Pointer` (including itself).

(&self, other: &Self)

Source from the content-addressed store, hash-verified

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.

Callers 1

from_strMethod · 0.80

Calls 2

as_strMethod · 0.80
lenMethod · 0.80

Tested by

no test coverage detected