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

Method get

src/pointer.rs:317–322  ·  view source on GitHub ↗

Attempts to get a `Token` by the index. Returns `None` if the index is out of bounds. ## Example ```rust use jsonptr::{Pointer, Token}; let ptr = Pointer::from_static("/foo/bar/qux"); assert_eq!(ptr.get(0), Some("foo".into())); assert_eq!(ptr.get(1), Some("bar".into())); assert_eq!(ptr.get(3), None); assert_eq!(ptr.get(..), Some(Pointer::from_static("/foo/bar/qux"))); assert_eq!(ptr.get(..1), So

(&'p self, index: I)

Source from the content-addressed store, hash-verified

315 /// assert_eq!(ptr.get(..), Some(Pointer::root()));
316 /// ```
317 pub fn get<'p, I>(&'p self, index: I) -> Option<I::Output>
318 where
319 I: PointerIndex<'p>,
320 {
321 index.get(self)
322 }
323
324 /// Attempts to resolve a [`R::Value`] based on the path in this [`Pointer`].
325 ///

Callers 7

labelsMethod · 0.45
labelsMethod · 0.45
resolveMethod · 0.45
resolve_jsonFunction · 0.45
resolve_tomlFunction · 0.45
split_atMethod · 0.45
replaceMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected