Trait OperationData

Source
pub trait OperationData {
    type DecodeError: Debug + Display + Error;

    // Required methods
    fn is_root(&self) -> bool;
    fn from_value(
        raw: Value,
        predicted_type: u64,
    ) -> Result<Self, Self::DecodeError>
       where Self: Sized;
    fn as_value(&self) -> Object<'_>;
    fn to_json_type(&self) -> u64;
}
Expand description

The necessary accessors needed to connect an Entity::OperationData to an Operations structure.

Required Associated Types§

Source

type DecodeError: Debug + Display + Error

The returned error, when the operation data cannot be parsed from the stored JSON value.

Required Methods§

Source

fn is_root(&self) -> bool

Whether this operation is a root operation.

Root operations are the operations that create an Entity. As such, Operations ensures that exactly one of these root operations exists in the operations composing an Entity. Furthermore, it also asserts, that this root operation is actually the first operation.

Source

fn from_value( raw: Value, predicted_type: u64, ) -> Result<Self, Self::DecodeError>
where Self: Sized,

Parses the stored JSON object as operation data.

This function takes the JSON value and the type of the operation data, which has been extracted from the JSON value.

§Errors

If the raw json value cannot be parsed as a Operation.

Source

fn as_value(&self) -> Object<'_>

Encodes this operation data in it’s JSON representation.

Source

fn to_json_type(&self) -> u64

Get an unique integer for each valid operation.

This is needed to tag the JSON value.

Implementors§