Skip to main content

Operations

Trait Operations 

Source
pub trait Operations: Model {
    type Op: Serialize + DeserializeOwned + JsonSchema;

    // Provided methods
    fn coalesces(previous: &Self::Op, next: &Self::Op) -> bool { ... }
    fn continuable(op: &Self::Op) -> bool { ... }
    fn describe(op: &Self::Op) -> OpDescription { ... }
    fn lands(&self, op: &Self::Op) -> Option<Place> { ... }
}
Expand description

A type with its own vocabulary of edits beside the generic ones: rich text’s marks and blocks. Its paths offer Path::perform; its Model impl calls operations_model! so records holding it route those edits’ gestures, landing places and schema to it.

Required Associated Types§

Source

type Op: Serialize + DeserializeOwned + JsonSchema

One edit of the type, in its own terms.

Provided Methods§

Source

fn coalesces(previous: &Self::Op, next: &Self::Op) -> bool

Whether next, straight after previous by the same actor, is the same gesture (typing on in one word): one undo step.

Source

fn continuable(op: &Self::Op) -> bool

Whether a gesture may go on after op.

Source

fn describe(op: &Self::Op) -> OpDescription

What op did, as a history entry records it: the kind of edit and its plain facts by name ({mark: "strong", words: 3}), which the reader’s message receives.

Source

fn lands(&self, op: &Self::Op) -> Option<Place>

Where the actor of op is after it applied (the caret after typed text), read from the value it applied to.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§