Skip to main content

Ref

Struct Ref 

Source
pub struct Ref<'a, 'd> { /* private fields */ }
Expand description

One value inside a Document.

Implementations§

Source§

impl<'a, 'd> Ref<'a, 'd>

Source

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

The text of a string value, borrowed unless it carried escapes.

Source

pub fn entries(&self) -> impl Iterator<Item = (Cow<'a, str>, Ref<'a, 'd>)> + '_

Members of an object, in the order they appeared.

Source

pub fn elements(&self) -> impl Iterator<Item = Ref<'a, 'd>> + '_

Elements of an array, in order.

Trait Implementations§

Source§

impl<'a, 'd> Clone for Ref<'a, 'd>

Source§

fn clone(&self) -> Ref<'a, 'd>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, 'd> Copy for Ref<'a, 'd>

Source§

impl Input for Ref<'_, '_>

Source§

type Child<'x> = Ref<'_, '_> where Self: 'x

An element of an array, or the value at a key. Implementations should make this converge, usually to themselves or to a reference to themselves. A type whose child is a strictly new type on every level would make the validator recurse forever at compile time.
Source§

fn kind(&self) -> Kind

Source§

fn as_bool(&self) -> Option<bool>

Source§

fn as_int(&self) -> Option<Int>

Source§

fn as_f64(&self) -> Option<f64>

Source§

fn as_str(&self) -> Option<Cow<'_, str>>

Source§

fn len(&self) -> usize

Elements for an array, keys for an object, zero otherwise.
Source§

fn item(&self, index: usize) -> Option<Self::Child<'_>>

Source§

fn slot(&self, key: &str) -> Slot<Self::Child<'_>>

Reads a key without collapsing absence into null.
Source§

fn each_key(&self, f: &mut dyn FnMut(&str))

Visits every key of an object, for the unknown-field check.
Source§

fn is_empty(&self) -> bool

Auto Trait Implementations§

§

impl<'a, 'd> Freeze for Ref<'a, 'd>

§

impl<'a, 'd> RefUnwindSafe for Ref<'a, 'd>

§

impl<'a, 'd> Send for Ref<'a, 'd>

§

impl<'a, 'd> Sync for Ref<'a, 'd>

§

impl<'a, 'd> Unpin for Ref<'a, 'd>

§

impl<'a, 'd> UnsafeUnpin for Ref<'a, 'd>

§

impl<'a, 'd> UnwindSafe for Ref<'a, 'd>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

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

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

Source§

type Error = !

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.