Skip to main content

Json

Trait Json 

Source
pub trait Json:
    Sized
    + Send
    + Sync
    + 'static {
    type Node<'a>: Node<'a, Self>;
    type PreparedKey: Send + Sync;
    type StringBuffer: Default;

    // Required methods
    fn prepare_key(key: &str) -> Self::PreparedKey;
    fn with_string_node<T>(
        buffer: &mut Self::StringBuffer,
        string: &str,
        f: impl FnOnce(Self::Node<'_>) -> T,
    ) -> T;
}
Expand description

One JSON representation.

Required Associated Types§

Source

type Node<'a>: Node<'a, Self>

Source

type PreparedKey: Send + Sync

Property name prepared once at compile time, for repeated object lookups.

Source

type StringBuffer: Default

Scratch storage for Json::with_string_node, reusable across calls.

Required Methods§

Source

fn prepare_key(key: &str) -> Self::PreparedKey

Source

fn with_string_node<T>( buffer: &mut Self::StringBuffer, string: &str, f: impl FnOnce(Self::Node<'_>) -> T, ) -> T

Call f with a node holding string, backed by buffer.

propertyNames validates each property name through this, so names run through the same subschema machinery as any other node of the representation.

Representations whose nodes point into an encoded document have two options: a plain string variant on the node type, or encoding a single-string document into buffer.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§