Struct Operation

Source
pub struct Operation<E: Entity> { /* private fields */ }
Expand description

An collection of the shared data, every Operation track, and the specific Operation data needed for an Entity's Operation.

Implementations§

Source§

impl<E: Entity> Operation<E>

Source

pub fn author(&self) -> IdentityStub

Return the author of this Operation.

Source

pub fn operation_data(&self) -> &E::OperationData

Return the operation data of this Operation.

Source

pub fn creation_time(&self) -> TimeStamp

Return the Unix time stamp of this Operations creation.

Source

pub fn metadata(&self) -> impl Iterator<Item = &(String, String)>

Return the metadata of this Operation.

Source

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

Encodes this Operation to it’s JSON value.

Source

pub fn from_value(raw: Value, author: IdentityStub) -> Result<Self, Error>

Parses this Operation from an JSON value.

§Errors

If the value does not conform to the expected JSON representation.

Source

pub fn id(&self) -> EntityId<E>

Return the ID of this operation.

This would first serialize the Operation to it’s JSON encoding and then calculate the sha256 hash of the resulting string.

Trait Implementations§

Source§

impl<E: Debug + Entity> Debug for Operation<E>
where E::OperationData: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de, E: Entity> Deserialize<'de> for Operation<E>

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<E: Entity> Display for Operation<E>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<E: Entity> Serialize for Operation<E>

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<E> Freeze for Operation<E>
where <E as Entity>::OperationData: Freeze,

§

impl<E> RefUnwindSafe for Operation<E>

§

impl<E> Send for Operation<E>
where <E as Entity>::OperationData: Send, E: Send,

§

impl<E> Sync for Operation<E>
where <E as Entity>::OperationData: Sync, E: Sync,

§

impl<E> Unpin for Operation<E>
where <E as Entity>::OperationData: Unpin, E: Unpin,

§

impl<E> UnwindSafe for Operation<E>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,