pub struct JsonPointer(/* private fields */);Expand description
A JSON Pointer.
Implementations§
Source§impl JsonPointer
impl JsonPointer
Sourcepub fn parse(s: &str) -> Result<&Self, JsonPointerSyntaxError>
pub fn parse(s: &str) -> Result<&Self, JsonPointerSyntaxError>
Parses a pointer from an RFC 6901 string.
The empty string is the valid root pointer.
All other strings must start with /.
Sourcepub fn head(&self) -> Option<&JsonPointerSegment>
pub fn head(&self) -> Option<&JsonPointerSegment>
Returns the first segment, or None for the root pointer.
Sourcepub fn tail(&self) -> &JsonPointer
pub fn tail(&self) -> &JsonPointer
Returns the pointer without its first segment.
For the root pointer, returns the root pointer.
Sourcepub fn segments(&self) -> JsonPointerSegments<'_> ⓘ
pub fn segments(&self) -> JsonPointerSegments<'_> ⓘ
Returns a borrowing iterator over the segments.
Sourcepub fn follow<'a, T: JsonPointerTarget<'a>>(
&self,
root: &'a (impl JsonPointee + ?Sized),
) -> Result<T, JsonPointerError>
pub fn follow<'a, T: JsonPointerTarget<'a>>( &self, root: &'a (impl JsonPointee + ?Sized), ) -> Result<T, JsonPointerError>
Follows this pointer through root and extracts the result as T.
Trait Implementations§
Source§impl AsRef<JsonPointer> for JsonPointerBuf
impl AsRef<JsonPointer> for JsonPointerBuf
Source§fn as_ref(&self) -> &JsonPointer
fn as_ref(&self) -> &JsonPointer
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl Borrow<JsonPointer> for JsonPointerBuf
impl Borrow<JsonPointer> for JsonPointerBuf
Source§fn borrow(&self) -> &JsonPointer
fn borrow(&self) -> &JsonPointer
Immutably borrows from an owned value. Read more
Source§impl Debug for JsonPointer
impl Debug for JsonPointer
Source§impl Display for JsonPointer
impl Display for JsonPointer
Source§impl<'a> From<&'a JsonPointer> for Cow<'a, JsonPointer>
impl<'a> From<&'a JsonPointer> for Cow<'a, JsonPointer>
Source§fn from(value: &'a JsonPointer) -> Self
fn from(value: &'a JsonPointer) -> Self
Converts to this type from the input type.
Source§impl From<&JsonPointer> for JsonPointerBuf
impl From<&JsonPointer> for JsonPointerBuf
Source§fn from(value: &JsonPointer) -> Self
fn from(value: &JsonPointer) -> Self
Converts to this type from the input type.
Source§impl Hash for JsonPointer
impl Hash for JsonPointer
Source§impl Ord for JsonPointer
impl Ord for JsonPointer
Source§impl PartialEq for JsonPointer
impl PartialEq for JsonPointer
Source§impl PartialOrd for JsonPointer
impl PartialOrd for JsonPointer
Source§impl ToOwned for JsonPointer
impl ToOwned for JsonPointer
Source§type Owned = JsonPointerBuf
type Owned = JsonPointerBuf
The resulting type after obtaining ownership.
Source§fn to_owned(&self) -> Self::Owned
fn to_owned(&self) -> Self::Owned
Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · Source§fn clone_into(&self, target: &mut Self::Owned)
fn clone_into(&self, target: &mut Self::Owned)
Uses borrowed data to replace owned data, usually by cloning. Read more