Skip to main content

JsonPointer

Struct JsonPointer 

Source
pub struct JsonPointer(/* private fields */);
Expand description

A JSON Pointer.

Implementations§

Source§

impl JsonPointer

Source

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 /.

Source

pub fn empty() -> &'static Self

Returns the empty root pointer.

Source

pub fn is_empty(&self) -> bool

Returns true if this is the empty root pointer.

Source

pub fn head(&self) -> Option<&JsonPointerSegment>

Returns the first segment, or None for the root pointer.

Source

pub fn tail(&self) -> &JsonPointer

Returns the pointer without its first segment.

For the root pointer, returns the root pointer.

Source

pub fn segments(&self) -> JsonPointerSegments<'_>

Returns a borrowing iterator over the segments.

Source

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

Source§

fn as_ref(&self) -> &JsonPointer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Borrow<JsonPointer> for JsonPointerBuf

Source§

fn borrow(&self) -> &JsonPointer

Immutably borrows from an owned value. Read more
Source§

impl Debug for JsonPointer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for JsonPointer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> From<&'a JsonPointer> for Cow<'a, JsonPointer>

Source§

fn from(value: &'a JsonPointer) -> Self

Converts to this type from the input type.
Source§

impl From<&JsonPointer> for JsonPointerBuf

Source§

fn from(value: &JsonPointer) -> Self

Converts to this type from the input type.
Source§

impl Hash for JsonPointer

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
Source§

impl Ord for JsonPointer

Source§

fn cmp(&self, other: &JsonPointer) -> Ordering

This method returns an Ordering between self and other. Read more
Source§

impl PartialEq for JsonPointer

Source§

fn eq(&self, other: &JsonPointer) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for JsonPointer

Source§

fn partial_cmp(&self, other: &JsonPointer) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl ToOwned for JsonPointer

Source§

type Owned = JsonPointerBuf

The resulting type after obtaining ownership.
Source§

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)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl Eq for JsonPointer

Source§

impl StructuralPartialEq for JsonPointer

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more