Skip to main content

CrdtDoc

Trait CrdtDoc 

Source
pub trait CrdtDoc: Send + Sync {
    // Required methods
    fn materialize(&self) -> Rope;
    fn kind(&self) -> CrdtKind;

    // Provided method
    fn apply_update(&mut self, _update: &CrdtUpdate) -> Result<(), SpecError> { ... }
}
Expand description

The CRDT-document border (SABER §5). A verbete body is ALWAYS one.

At M0a only CrdtDoc::materialize is realized. local_edit/apply_update are the M2 wire borders; the default impls return a typed SpecError so a caller that reaches for them before M2 sees the gap mechanically.

Required Methods§

Source

fn materialize(&self) -> Rope

The current materialized text the renderer consumes (SABER §5 render border). Realized at M0a.

Source

fn kind(&self) -> CrdtKind

The engine kind backing this doc.

Provided Methods§

Source

fn apply_update(&mut self, _update: &CrdtUpdate) -> Result<(), SpecError>

Apply a wire delta from another replica (SABER §2 CrdtUpdate). M2 work — degenerate docs have no wire form.

§Errors

Always SpecError::NoWireForm at M0a for the SoloDoc.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§