Skip to main content

Stamped

Struct Stamped 

Source
pub struct Stamped<O> {
    pub operation: O,
    pub now_ms: i64,
}
Expand description

A record operation with the origin’s time attached: the replayable action of a #[resource] record.

Fields§

§operation: O§now_ms: i64

Implementations§

Source§

impl<O: DeserializeOwned> Stamped<O>

Source

pub fn from_json(value: Value) -> Result<Self, Error>

The stamped operation in value, its JSON form.

§Errors

Why value is not a stamped operation of O.

Trait Implementations§

Source§

impl<O: Operation> Action for Stamped<O>

Source§

fn apply(&self, doc: &mut Doc) -> Result<(), ActionError>

Read the record, run the method, write back what changed (apply_operation).

Source§

fn change_kind(&self) -> ChangeKind

An outbox settlement is content from outside and forgetting a settled entry is housekeeping: neither is anyone’s undo step, so an undo never sends a mail twice.

Source§

fn inverse_encoded(&self, doc: &Doc) -> Option<EncodedAction>

A verb that declares its undo is undone by applying that verb, and a change of a record that queues by applying the edits that restore it: either queues the compensating outside consequence.

Source§

fn describe(&self, doc: &Doc) -> Option<Described>

A field edit with the value before and after, or a verb with its plain arguments, and the item either addressed.

Source§

fn made(&self, doc: &Doc) -> Option<ActionItem>

The item this verb made, read once it wrote: the record’s item it added (a note, an issue, a message), or the item the app named as it ran (a file a device will write). The document before the verb applied held neither, so [Self::describe] could not name it.

Source§

fn locus(&self) -> ExecutionLocus

Where this action prefers to run. Defaults to ExecutionLocus::ClientLocal.
Source§

fn risk(&self) -> RiskLevel

The consequence class of this particular value — what it would do, not what its type can do. A generic edit action classifies each value (deleting a clip is Destructive, trimming one is not), and the host asks for the same confirmation a declared destructive action gets whenever requires_confirmation holds. Must be a pure function of self. Defaults to Low.
Source§

fn action_kind(&self) -> ActionKind

What kind of action this value is: whether it only changes the document or also reaches outside it. Must be a pure function of self. An action that records an outside consequence in the document (an outbox entry) is Outside; the default is Undoable.
Source§

fn incoming_message(&self) -> bool

Whether this value records a message someone received (a chat post, a delivered mail). The executor marks its change with INCOMING_MESSAGE_FACET. Must be a pure function of self.
Source§

fn irreversible(&self) -> bool

Whether this value loses something Undo cannot bring back, beside the document change Undo reverts (an account’s secret every device forgets). See IRREVERSIBLE_TAG. Must be a pure function of self.
Source§

fn compensates(&self) -> bool

Whether this value’s undo is its own code’s to compute (inverse_encoded may answer one): a device applying it from an app’s model module, which does not compute undo, writes no entry another device would check that undo against. Must be a pure function of self.
Source§

fn inverse_before(&self, doc: &AutoCommit) -> Option<Self>
where Self: Sized,

The document action that undoes this one when apply records an outside consequence in the document (an outbox entry, a filesystem op queue). Computed against the document before this action runs, so a delete can still read the row it removes. Read more
Source§

fn readers(&self) -> Option<Vec<MemberId>>

The members who alone read what this value changes, when what it changes says who reads it (a direct conversation); None when every member who reads the record reads it. The executor marks its change with READERS_FACET. Must be a pure function of self.
Source§

fn steps(&self, doc: &AutoCommit) -> Option<Vec<(Box<dyn Action>, Vec<u8>)>>

The actions this value is, one for each step it takes, when it stands for several: an undo of three steps is three undos of one, newest first. The executor applies each as an action of its own, so every change names the one step it moved, and a peer replays it as that one action. Each is its payload under this value’s type, with the action it decodes to. None for a value that is one step, as almost every value is. Read from doc before anything applies.
Source§

impl<O: Clone> Clone for Stamped<O>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<O: Debug> Debug for Stamped<O>

Source§

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

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

impl<'de, O: DeserializeOwned> Deserialize<'de> for Stamped<O>

Source§

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

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

impl<O> Serialize for Stamped<O>
where O: Serialize,

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<O> Forget for Stamped<O>

§

impl<O> Freeze for Stamped<O>
where O: Freeze,

§

impl<O> Move for Stamped<O>

§

impl<O> RefUnwindSafe for Stamped<O>
where O: RefUnwindSafe,

§

impl<O> Send for Stamped<O>
where O: Send,

§

impl<O> Sync for Stamped<O>
where O: Sync,

§

impl<O> Unpin for Stamped<O>
where O: Unpin,

§

impl<O> UnsafeUnpin for Stamped<O>
where O: UnsafeUnpin,

§

impl<O> UnwindSafe for Stamped<O>
where O: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

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

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more