Skip to main content

Instance

Trait Instance 

Source
pub trait Instance<'a>: Copy {
    type Array: ArrayView<'a, Item = Self>;
    type Object: ObjectView<'a, Item = Self>;

    // Required method
    fn view(self) -> View<'a, Self>;

    // Provided method
    fn kind(self) -> Kind { ... }
}
Expand description

A JSON value the evaluator can read in place. Cheap to copy (a reference or a handle); values reached through it (items, property values, strings) live as long as 'a.

Required Associated Types§

Source

type Array: ArrayView<'a, Item = Self>

An array of instances.

Source

type Object: ObjectView<'a, Item = Self>

An object of named instances.

Required Methods§

Source

fn view(self) -> View<'a, Self>

The value’s kind and content.

Provided Methods§

Source

fn kind(self) -> Kind

The value’s kind alone (for type tests, which need no content).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'a> Instance<'a> for &'a Value

Source§

type Array = &'a [Value]

Source§

type Object = &'a Map<String, Value>

Source§

fn view(self) -> View<'a, Self>

Source§

fn kind(self) -> Kind

Implementors§