Struct Pointer

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

A JSON Pointer is a string containing a sequence of zero or more reference Tokens, each prefixed by a '/' character.

See RFC 6901 for more information.

§Example

use jsonptr::{Pointer, resolve::Resolve};
use serde_json::{json, Value};

let data = json!({ "foo": { "bar": "baz" } });
let ptr = Pointer::from_static("/foo/bar");
let bar = data.resolve(&ptr).unwrap();
assert_eq!(bar, "baz");

Implementations§

Source§

impl Pointer

Source

pub unsafe fn new_unchecked<S: AsRef<str> + ?Sized>(s: &S) -> &Self

Create a Pointer from a string that is known to be correctly encoded.

This is a cost-free conversion.

§Safety

The provided string must adhere to RFC 6901:

  • The pointer must start with '/' (%x2F) unless empty
  • Tokens must be properly encoded:
    • '~' (%x7E) must be escaped as "~0"
    • '/' (%x2F) must be escaped as "~1"

For potentially fallible parsing, see Pointer::parse.

Source

pub const fn root() -> &'static Self

Constant reference to a root pointer

Source

pub fn parse<S: AsRef<str> + ?Sized>(s: &S) -> Result<&Self, ParseError>

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.

Source

pub const fn from_static(s: &'static str) -> &'static Self

Creates a static Pointer from a string.

§Panics

Will panic if the string does not represent a valid pointer.

§Examples
use jsonptr::{Pointer, resolve::Resolve};
use serde_json::{json, Value};

const POINTER: &Pointer = Pointer::from_static("/foo/bar");
let data = json!({ "foo": { "bar": "baz" } });
let bar = data.resolve(POINTER).unwrap();
assert_eq!(bar, "baz");
Source

pub fn as_str(&self) -> &str

The encoded string representation of this Pointer

Source

pub fn to_buf(&self) -> PointerBuf

Converts into an owned PointerBuf

Source

pub fn tokens(&self) -> Tokens<'_>

Returns an iterator of Tokens in the Pointer.

Source

pub fn count(&self) -> usize

Returns the number of tokens in the Pointer.

Source

pub fn is_root(&self) -> bool

Returns true if the JSON Pointer equals "".

Source

pub fn to_json_value(&self) -> Value

Returns a serde_json::Value representation of this Pointer

Source

pub fn back(&self) -> Option<Token<'_>>

Returns the last Token in the Pointer.

Source

pub fn last(&self) -> Option<Token<'_>>

Returns the last token in the Pointer.

alias for back

Source

pub fn front(&self) -> Option<Token<'_>>

Returns the first Token in the Pointer.

Source

pub fn first(&self) -> Option<Token<'_>>

Returns the first Token in the Pointer.

alias for front

Source

pub fn split_front(&self) -> Option<(Token<'_>, &Self)>

Splits the Pointer into the first Token and a remainder Pointer.

Source

pub fn split_at(&self, offset: usize) -> Option<(&Self, &Self)>

Splits the Pointer at the given index if the character at the index is a separator slash ('/'), returning Some((head, tail)). Otherwise, returns None.

For the following JSON Pointer, the following splits are possible (0, 4, 8):

/foo/bar/baz
↑   ↑   ↑
0   4   8

All other indices will return None.

§Example
let ptr = Pointer::from_static("/foo/bar/baz");
let (head, tail) = ptr.split_at(4).unwrap();
assert_eq!(head, Pointer::from_static("/foo"));
assert_eq!(tail, Pointer::from_static("/bar/baz"));
assert_eq!(ptr.split_at(3), None);
Source

pub fn split_back(&self) -> Option<(&Self, Token<'_>)>

Splits the Pointer into the parent path and the last Token.

Source

pub fn parent(&self) -> Option<&Self>

A pointer to the parent of the current path.

Source

pub fn strip_suffix<'a>(&'a self, suffix: &Self) -> Option<&'a Self>

Returns the pointer stripped of the given suffix.

Source

pub fn strip_prefix<'a>(&'a self, prefix: &Self) -> Option<&'a Self>

Returns the pointer stripped of the given prefix.

Source

pub fn ends_with(&self, other: &Self) -> bool

Returns whether self has a suffix of other.

Note that Pointer::root is only a valid suffix of itself.

Source

pub fn starts_with(&self, other: &Self) -> bool

Returns whether self has a prefix of other.

Note that Pointer::root is a valid prefix of any Pointer (including itself).

Source

pub fn get<'p, I>(&'p self, index: I) -> Option<I::Output>
where I: PointerIndex<'p>,

Attempts to get a Token by the index. Returns None if the index is out of bounds.

§Example
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), Some(Pointer::from_static("/foo")));
assert_eq!(ptr.get(1..3), Some(Pointer::from_static("/bar/qux")));
assert_eq!(ptr.get(1..=2), Some(Pointer::from_static("/bar/qux")));

let ptr = Pointer::root();
assert_eq!(ptr.get(0), None);
assert_eq!(ptr.get(..), Some(Pointer::root()));
Source

pub fn resolve<'v, R: Resolve>( &self, value: &'v R, ) -> Result<&'v R::Value, R::Error>

Attempts to resolve a R::Value based on the path in this Pointer.

§Errors

Returns R::Error if an error occurs while resolving.

The rules of such are determined by the R’s implementation of Resolve but provided implementations return ResolveError if:

  • The path is unreachable (e.g. a scalar is encountered prior to the end of the path)
  • The path is not found (e.g. a key in an object or an index in an array does not exist)
  • A Token cannot be parsed as an array Index
  • An array Index is out of bounds
Source

pub fn resolve_mut<'v, R: ResolveMut>( &self, value: &'v mut R, ) -> Result<&'v mut R::Value, R::Error>

Attempts to resolve a mutable R::Value based on the path in this Pointer.

§Errors

Returns R::Error if an error occurs while resolving.

The rules of such are determined by the R’s implementation of ResolveMut but provided implementations return ResolveError if:

  • The path is unreachable (e.g. a scalar is encountered prior to the end of the path)
  • The path is not found (e.g. a key in an object or an index in an array does not exist)
  • A Token cannot be parsed as an array Index
  • An array Index is out of bounds
Source

pub fn intersection<'a>(&'a self, other: &Self) -> &'a Self

Finds the commonality between this and another Pointer.

Source

pub fn delete<D: Delete>(&self, value: &mut D) -> Option<D::Value>

Attempts to delete a serde_json::Value based upon the path in this Pointer.

The rules of deletion are determined by the D’s implementation of Delete. The supplied implementations ("json" & "toml") operate as follows:

  • If the Pointer can be resolved, the Value is deleted and returned.
  • If the Pointer fails to resolve for any reason, Ok(None) is returned.
  • If the Pointer is root, value is replaced:
    • "json": serde_json::Value::Null
    • "toml": toml::Value::Table::Default
§Examples
§Deleting a resolved pointer:
use jsonptr::{Pointer, delete::Delete};
use serde_json::json;

let mut data = json!({ "foo": { "bar": { "baz": "qux" } } });
let ptr = Pointer::from_static("/foo/bar/baz");
assert_eq!(data.delete(&ptr), Some("qux".into()));
assert_eq!(data, json!({ "foo": { "bar": {} } }));
§Deleting a non-existent Pointer returns None:
use jsonptr::{ Pointer, delete::Delete };
use serde_json::json;

let mut data = json!({});
let ptr = Pointer::from_static("/foo/bar/baz");
assert_eq!(ptr.delete(&mut data), None);
assert_eq!(data, json!({}));
§Deleting a root pointer replaces the value with Value::Null:
use jsonptr::{Pointer, delete::Delete};
use serde_json::json;

let mut data = json!({ "foo": { "bar": "baz" } });
let ptr = Pointer::root();
assert_eq!(data.delete(&ptr), Some(json!({ "foo": { "bar": "baz" } })));
assert!(data.is_null());
Source

pub fn assign<D, V>( &self, dest: &mut D, src: V, ) -> Result<Option<D::Value>, D::Error>
where D: Assign, V: Into<D::Value>,

Attempts to assign src to dest based on the path in this Pointer.

If the path is partially available, the missing portions will be created. If the path contains a zero index, such as "/0", then an array will be created. Otherwise, objects will be utilized to create the missing path.

§Example
use jsonptr::Pointer;
use serde_json::{json, Value};

let mut data = json!([]);
let mut ptr = Pointer::from_static("/0/foo");
let replaced = ptr.assign(&mut data, json!("bar")).unwrap();
assert_eq!(data, json!([{"foo": "bar"}]));
assert_eq!(replaced, None);
§Errors

Returns Assign::Error if the path is invalid or if the value cannot be assigned.

Source

pub fn components(&self) -> Components<'_>

Returns Components of this JSON Pointer.

A Component is either Token or the root location of a document.

§Example
let ptr = Pointer::parse("/a/b").unwrap();
let mut components = ptr.components();
assert_eq!(components.next(), Some(Component::Root));
assert_eq!(components.next(), Some(Component::Token("a".into())));
assert_eq!(components.next(), Some(Component::Token("b".into())));
assert_eq!(components.next(), None);
Source

pub fn with_trailing_token<'t>(&self, token: impl Into<Token<'t>>) -> PointerBuf

Creates an owned PointerBuf like self but with token appended.

See PointerBuf::push_back for more details.

Note: this method allocates. If you find yourself calling it more than once for a given pointer, consider using PointerBuf::push_back instead.

§Examples
let ptr = jsonptr::Pointer::from_static("/foo");
let foobar = ptr.with_trailing_token("bar");
assert_eq!(foobar, "/foo/bar");
Source

pub fn with_leading_token<'t>(&self, token: impl Into<Token<'t>>) -> PointerBuf

Creates an owned PointerBuf like self but with token prepended.

See PointerBuf::push_front for more details.

Note: this method allocates. If you find yourself calling it more than once for a given pointer, consider using PointerBuf::push_front instead.

§Examples
let ptr = jsonptr::Pointer::from_static("/bar");
let foobar = ptr.with_leading_token("foo");
assert_eq!(foobar, "/foo/bar");
Source

pub fn concat(&self, other: &Pointer) -> PointerBuf

Creates an owned PointerBuf like self but with other appended to the end.

See PointerBuf::append for more details.

Note: this method allocates. If you find yourself calling it more than given pointer, consider using PointerBuf::append instead.

§Examples
let ptr = jsonptr::Pointer::from_static("/foo");
let other = jsonptr::Pointer::from_static("/bar/baz");
assert_eq!(ptr.concat(other), "/foo/bar/baz");
Source

pub fn len(&self) -> usize

This length expresses the byte count of the underlying string that represents the RFC 6091 Pointer. See also [std::str::len].

§Examples
let mut ptr = jsonptr::PointerBuf::parse("/foo/bar").unwrap();
assert_eq!(ptr.len(), 8);

ptr.push_back("~");
assert_eq!(ptr.len(), 11);
Source

pub fn is_empty(&self) -> bool

Returns true if the Pointer is empty (i.e. root).

§Examples
let mut ptr = jsonptr::PointerBuf::new();
assert!(ptr.is_empty());

ptr.push_back("foo");
assert!(!ptr.is_empty());
Source

pub fn into_buf(self: Box<Pointer>) -> PointerBuf

Converts a Box<Pointer> into a PointerBuf without copying or allocating.

Trait Implementations§

Source§

impl AsRef<[u8]> for Pointer

Source§

fn as_ref(&self) -> &[u8]

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

impl AsRef<Pointer> for Pointer

Source§

fn as_ref(&self) -> &Pointer

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

impl AsRef<Pointer> for PointerBuf

Source§

fn as_ref(&self) -> &Pointer

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

impl AsRef<str> for Pointer

Source§

fn as_ref(&self) -> &str

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

impl Borrow<Pointer> for PointerBuf

Source§

fn borrow(&self) -> &Pointer

Immutably borrows from an owned value. Read more
Source§

impl Borrow<str> for Pointer

Source§

fn borrow(&self) -> &str

Immutably borrows from an owned value. Read more
Source§

impl Debug for Pointer

Source§

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

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

impl Default for &'static Pointer

Source§

fn default() -> Self

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

impl<'de: 'p, 'p> Deserialize<'de> for &'p Pointer

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Pointer

Source§

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

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

impl<'t> From<&'t Pointer> for Components<'t>

Source§

fn from(pointer: &'t Pointer) -> Self

Converts to this type from the input type.
Source§

impl<'p> From<&'p Pointer> for Cow<'p, Pointer>

Source§

fn from(value: &'p Pointer) -> Self

Converts to this type from the input type.
Source§

impl From<&Pointer> for Value

Source§

fn from(ptr: &Pointer) -> Self

Converts to this type from the input type.
Source§

impl From<PointerBuf> for Box<Pointer>

Source§

fn from(value: PointerBuf) -> Self

Converts to this type from the input type.
Source§

impl Hash for Pointer

Source§

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

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

impl<'a> IntoIterator for &'a Pointer

Source§

type Item = Token<'a>

The type of the elements being iterated over.
Source§

type IntoIter = Tokens<'a>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl Ord for Pointer

Source§

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

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

impl PartialEq<&Pointer> for PointerBuf

Source§

fn eq(&self, other: &&Pointer) -> 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 PartialEq<&str> for Pointer

Source§

fn eq(&self, other: &&str) -> 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 PartialEq<Pointer> for &str

Source§

fn eq(&self, other: &Pointer) -> 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 PartialEq<Pointer> for PointerBuf

Source§

fn eq(&self, other: &Pointer) -> 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 PartialEq<Pointer> for String

Source§

fn eq(&self, other: &Pointer) -> 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 PartialEq<Pointer> for str

Source§

fn eq(&self, other: &Pointer) -> 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 PartialEq<PointerBuf> for &Pointer

Source§

fn eq(&self, other: &PointerBuf) -> 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 PartialEq<PointerBuf> for Pointer

Source§

fn eq(&self, other: &PointerBuf) -> 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<'p> PartialEq<String> for &'p Pointer

Source§

fn eq(&self, other: &String) -> 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 PartialEq<String> for Pointer

Source§

fn eq(&self, other: &String) -> 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 PartialEq<str> for Pointer

Source§

fn eq(&self, other: &str) -> 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 PartialEq for Pointer

Source§

fn eq(&self, other: &Pointer) -> 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<&Pointer> for PointerBuf

Source§

fn partial_cmp(&self, other: &&Pointer) -> 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 PartialOrd<&str> for &Pointer

Source§

fn partial_cmp(&self, other: &&str) -> 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 PartialOrd<Pointer> for &str

Source§

fn partial_cmp(&self, other: &Pointer) -> 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 PartialOrd<Pointer> for PointerBuf

Source§

fn partial_cmp(&self, other: &Pointer) -> 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 PartialOrd<Pointer> for String

Source§

fn partial_cmp(&self, other: &Pointer) -> 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 PartialOrd<Pointer> for str

Source§

fn partial_cmp(&self, other: &Pointer) -> 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<'p> PartialOrd<PointerBuf> for &'p Pointer

Source§

fn partial_cmp(&self, other: &PointerBuf) -> 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 PartialOrd<PointerBuf> for Pointer

Source§

fn partial_cmp(&self, other: &PointerBuf) -> 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 PartialOrd<String> for &Pointer

Source§

fn partial_cmp(&self, other: &String) -> 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 PartialOrd<String> for Pointer

Source§

fn partial_cmp(&self, other: &String) -> 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 PartialOrd for Pointer

Source§

fn partial_cmp(&self, other: &Pointer) -> 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 Serialize for Pointer

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl ToOwned for Pointer

Source§

type Owned = PointerBuf

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 Pointer

Source§

impl StructuralPartialEq for Pointer

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