Skip to main content

PrevFailure

Enum PrevFailure 

Source
pub enum PrevFailure {
    NotFound {
        arg_path: String,
        prev_path: String,
        resolved_prefix: String,
        missing: String,
        available: Vec<String>,
    },
    WrongType {
        arg_path: String,
        prev_path: String,
        resolved_prefix: String,
        segment: String,
        expected: &'static str,
        found: &'static str,
    },
    Unsupported {
        arg_path: String,
        prev_path: String,
        segment: String,
    },
}
Expand description

Explains why a $prev path failed to resolve, for error-message construction. Distinguishes three mistakes that a single generic “not found” message conflates:

  • the field/index simply isn’t there (NotFound);
  • a segment expects an object or array to index into, but the prior result holds a scalar at that point (WrongType);
  • the bracket syntax itself isn’t a supported index form (Unsupported).

Variants§

§

NotFound

A path segment names a field or index that does not exist on an otherwise correctly-typed container.

Fields

§arg_path: String

Path to the offending $prev reference within the verb argument it appears in (empty when the argument itself is the reference).

§prev_path: String

The full $prev path that was attempted, e.g. $prev.user.id.

§resolved_prefix: String

The $prev-relative path successfully traversed before the miss.

§missing: String

The field name or [index] that could not be found.

§available: Vec<String>

Sibling field names (object) or a length note (array) at the point of failure.

§

WrongType

A path segment expects an object (for a field) or an array (for an index) to continue into, but the prior result holds a different JSON type at that point.

Fields

§arg_path: String
§prev_path: String
§resolved_prefix: String

The $prev-relative path successfully traversed before the type mismatch — this is what actually holds found.

§segment: String

The field name or [index] that could not be applied.

§expected: &'static str
§found: &'static str
§

Unsupported

Bracket syntax that is not a valid non-negative-integer index.

Fields

§arg_path: String
§prev_path: String
§segment: String

The unsupported segment as written, e.g. [bad].

Trait Implementations§

Source§

impl Clone for PrevFailure

Source§

fn clone(&self) -> PrevFailure

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 Debug for PrevFailure

Source§

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

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

impl Display for PrevFailure

Source§

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

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

impl PartialEq for PrevFailure

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PrevFailure

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