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§
Sourcetype DecodeError: Debug + Display + Error
type DecodeError: Debug + Display + Error
The returned error, when the operation data cannot be parsed from the stored JSON value.
Required Methods§
Sourcefn is_root(&self) -> bool
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.
Sourcefn from_value(
raw: Value,
predicted_type: u64,
) -> Result<Self, Self::DecodeError>where
Self: Sized,
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.
Sourcefn to_json_type(&self) -> u64
fn to_json_type(&self) -> u64
Get an unique integer for each valid operation.
This is needed to tag the JSON value.