Skip to main content

Reverting

Struct Reverting 

Source
pub struct Reverting<O> { /* private fields */ }
Expand description

The undo of one change of a record that queues, too large to record its restoring field edits: it names the change (its writer and the heads it was made on), derives the edits that restore what the change wrote from the record before and after it, applies them, and runs the record’s queue so what the change queued outside is compensated.

Trait Implementations§

Source§

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

Source§

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

Apply this action’s mutation to doc. See the trait contract. Read more
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 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 inverse_encoded(&self, doc: &AutoCommit) -> Option<EncodedAction>

inverse_before as an encoded action, so the API can undo through apply after the concrete type has been erased. Read more
Source§

fn change_kind(&self) -> ChangeKind

Whether this value changes the document’s content or is housekeeping about it (a read marker, a reading position). The executor writes it into the change’s ActionContext, where a workspace activity feed reads it. Must be a pure function of self. Defaults to Content.
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 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 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 describe(&self, doc: &AutoCommit) -> Option<Described>

What this value does and to which item, as history records it: a field edit with its values before and after, a verb with its plain arguments, or a group of those. Read from doc as it is before the value applies, on the origin only; replicas replay it with the change. None lets the executor describe the value as the verb its encoded form names (crate::Described::from_encoded).
Source§

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

The item this value made, read from doc with its writes as an open transaction: what history names a change that creates something by (“Created ‘Spring plans’”), which doc before the value applied could not name because the item did not exist yet. None when the value made no item of its own, or names none itself; the executor then keeps the description it read before the value applied.
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> Debug for Reverting<O>

Source§

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

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

impl<'de, O> Deserialize<'de> for Reverting<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 Reverting<O>

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 Reverting<O>

§

impl<O> Freeze for Reverting<O>
where PhantomData<O>: Freeze,

§

impl<O> Move for Reverting<O>

§

impl<O> RefUnwindSafe for Reverting<O>

§

impl<O> Send for Reverting<O>
where PhantomData<O>: Send,

§

impl<O> Sync for Reverting<O>
where PhantomData<O>: Sync,

§

impl<O> Unpin for Reverting<O>
where PhantomData<O>: Unpin,

§

impl<O> UnsafeUnpin for Reverting<O>

§

impl<O> UnwindSafe for Reverting<O>

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> 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, 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