Skip to main content

Data

Trait Data 

Source
pub trait Data: Sized {
    const TEXT: bool = false;

    // Required methods
    fn encode(&self) -> Json;
    fn decode(json: &Json) -> Result<Self, DecodeError>;
}
Expand description

A Rust type that a Flow data type maps to, converted under the encoding.

Provided Associated Constants§

Source

const TEXT: bool = false

Whether this is Text, whose dictionaries encode as JSON objects.

Required Methods§

Source

fn encode(&self) -> Json

The value’s JSON.

Source

fn decode(json: &Json) -> Result<Self, DecodeError>

The value json encodes, or why it encodes none.

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 Data for ()

Unit, the empty array.

Source§

fn encode(&self) -> Json

Source§

fn decode(json: &Json) -> Result<Self, DecodeError>

Source§

impl Data for Infallible

Never, which has no values.

Source§

impl Data for String

Source§

const TEXT: bool = true

Source§

fn encode(&self) -> Json

Source§

fn decode(json: &Json) -> Result<Self, DecodeError>

Source§

impl Data for bool

Source§

fn encode(&self) -> Json

Source§

fn decode(json: &Json) -> Result<Self, DecodeError>

Source§

impl<A: Data, B: Data, C: Data, D: Data, E: Data, F: Data, G: Data, H: Data> Data for (A, B, C, D, E, F, G, H)

A tuple: an array of its elements.

Source§

fn encode(&self) -> Json

Source§

fn decode(json: &Json) -> Result<Self, DecodeError>

Source§

impl<A: Data, B: Data, C: Data, D: Data, E: Data, F: Data, G: Data> Data for (A, B, C, D, E, F, G)

A tuple: an array of its elements.

Source§

fn encode(&self) -> Json

Source§

fn decode(json: &Json) -> Result<Self, DecodeError>

Source§

impl<A: Data, B: Data, C: Data, D: Data, E: Data, F: Data> Data for (A, B, C, D, E, F)

A tuple: an array of its elements.

Source§

fn encode(&self) -> Json

Source§

fn decode(json: &Json) -> Result<Self, DecodeError>

Source§

impl<A: Data, B: Data, C: Data, D: Data, E: Data> Data for (A, B, C, D, E)

A tuple: an array of its elements.

Source§

fn encode(&self) -> Json

Source§

fn decode(json: &Json) -> Result<Self, DecodeError>

Source§

impl<A: Data, B: Data, C: Data, D: Data> Data for (A, B, C, D)

A tuple: an array of its elements.

Source§

fn encode(&self) -> Json

Source§

fn decode(json: &Json) -> Result<Self, DecodeError>

Source§

impl<A: Data, B: Data, C: Data> Data for (A, B, C)

A tuple: an array of its elements.

Source§

fn encode(&self) -> Json

Source§

fn decode(json: &Json) -> Result<Self, DecodeError>

Source§

impl<A: Data, B: Data> Data for (A, B)

A tuple: an array of its elements.

Source§

fn encode(&self) -> Json

Source§

fn decode(json: &Json) -> Result<Self, DecodeError>

Source§

impl<K: Data + Ord, V: Data> Data for BTreeMap<K, V>

Dict<K, V>: an object when the keys are Text, and otherwise an array of [key, value] pairs in ascending key order. Two equal keys are refused.

Source§

fn encode(&self) -> Json

Source§

fn decode(json: &Json) -> Result<Self, DecodeError>

Source§

impl<T: Data + Ord> Data for BTreeSet<T>

Set<T>, in ascending order; repeated elements collapse.

Source§

fn encode(&self) -> Json

Source§

fn decode(json: &Json) -> Result<Self, DecodeError>

Source§

impl<T: Data, E: Data> Data for Result<T, E>

Ordinary nested Result<T, E> data; Tool completion is a separate boundary.

Source§

fn encode(&self) -> Json

Source§

fn decode(json: &Json) -> Result<Self, DecodeError>

Source§

impl<T: Data> Data for Box<T>

A part a recursive type holds directly.

Source§

fn encode(&self) -> Json

Source§

fn decode(json: &Json) -> Result<Self, DecodeError>

Source§

impl<T: Data> Data for Option<T>

Option<T> anywhere but a record field: "None" or {"Some": v}.

Source§

fn encode(&self) -> Json

Source§

fn decode(json: &Json) -> Result<Self, DecodeError>

Source§

impl<T: Data> Data for Vec<T>

List<T>.

Source§

fn encode(&self) -> Json

Source§

fn decode(json: &Json) -> Result<Self, DecodeError>

Implementors§

Source§

impl Data for Bytes

Source§

impl Data for Decimal

Source§

impl Data for Duration

Source§

impl Data for Instant

Source§

impl Data for Int

Source§

impl Data for Json

A Tool’s type parameter: the JSON itself, untouched.

Source§

impl Data for JsonValue

Source§

impl<const INDEX: usize> Data for Value<INDEX>