Struct JsonPointer

Source
pub struct JsonPointer<'a> { /* private fields */ }
Expand description

A structure representing a complete pointer, comprising multiple JsonPointerComponents

Implementations§

Source§

impl<'a> JsonPointer<'a>

Source

pub fn root() -> Self

Returns a root JsonPointer instance

Source

pub fn is_root(&self) -> bool

Checks to see if a pointer is just a top level root element

Source

pub fn len(&self) -> usize

Returns the number of JsonPointerComponents within the pointer

Source

pub fn is_empty(&self) -> bool

Checks whether the pointer is the empty pointer

Source

pub fn push_names(&mut self, names: &[&'a str])

Push a whole bunch of names onto the end of the path in order

Source

pub fn push_indexes(&mut self, indexes: &[usize])

Push a whole bunch of indexes onto the end of the path in order

Source

pub fn push_name(&mut self, name: String)

Push a new JsonPointerComponent::Name onto the end of the pointer

Source

pub fn push_index(&mut self, index: usize)

Push a new JsonPointerComponent::Index onto the end of the pointer

Source

pub fn pop(&mut self) -> Option<JsonPointerComponent<'a>>

Pop the last component off the back of the pointer

Source

pub fn matches(&self, rhs: &'a JsonPointer<'_>) -> bool

Checks whether a path matches another path.

Source

pub fn as_str(&self) -> Cow<'a, str>

Serialise the pointer into a string representation that’s compliant with RFC 6901

Trait Implementations§

Source§

impl<'a> Add<&JsonPointer<'a>> for JsonPointer<'a>

Source§

fn add(self, rhs: &JsonPointer<'a>) -> Self

Concatenate two JsonPointer instances.

Source§

type Output = JsonPointer<'a>

The resulting type after applying the + operator.
Source§

impl<'a> Debug for JsonPointer<'a>

Source§

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

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

impl<'a> Default for JsonPointer<'a>

Source§

fn default() -> JsonPointer<'a>

Returns the “default value” for a type. Read more
Source§

impl<'a> Display for JsonPointer<'a>

Source§

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

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

impl<'a> Hash for JsonPointer<'a>

Source§

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

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

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a> PartialEq for JsonPointer<'a>

Source§

fn eq(&self, other: &Self) -> 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<'a> Eq for JsonPointer<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for JsonPointer<'a>

§

impl<'a> RefUnwindSafe for JsonPointer<'a>

§

impl<'a> Send for JsonPointer<'a>

§

impl<'a> Sync for JsonPointer<'a>

§

impl<'a> Unpin for JsonPointer<'a>

§

impl<'a> UnwindSafe for JsonPointer<'a>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.