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

Method parse

src/pointer.rs:82–85  ·  view source on GitHub ↗

Attempts to parse a string into a `Pointer`. If successful, this does not allocate. ## Errors Returns a `ParseError` if the string is not a valid JSON Pointer.

(s: &S)

Source from the content-addressed store, hash-verified

80 /// ## Errors
81 /// Returns a `ParseError` if the string is not a valid JSON Pointer.
82 pub fn parse<S: AsRef<str> + ?Sized>(s: &S) -> Result<&Self, ParseError> {
83 // SAFETY: we validate first
84 validate(s.as_ref()).map(|s| unsafe { Self::new_unchecked(s) })
85 }
86
87 /// Creates a static `Pointer` from a string.
88 ///

Callers

nothing calls this directly

Calls 3

validateFunction · 0.85
as_refMethod · 0.80
into_reportMethod · 0.80

Tested by

no test coverage detected