Enum jsonschema::paths::PathChunk[][src]

pub enum PathChunk {
    Property(String),
    Index(usize),
    Keyword(&'static str),
}
Expand description

A key within a JSON object or an index within a JSON array. A sequence of chunks represents a valid path within a JSON value.

Example:

{
   "cmd": ["ls", "-lh", "/home"]
}

To extract “/home” from the JSON object above, we need to take two steps:

  1. Go into property “cmd”. It corresponds to PathChunk::Property("cmd".to_string()).
  2. Take the 2nd value from the array - PathChunk::Index(2)

The primary purpose of this enum is to avoid converting indexes to strings during validation.

Variants

Property(String)

Property name within a JSON object.

Index(usize)

Index within a JSON array.

Keyword(&'static str)

JSON Schema keyword.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.