Sign in

    yrs

    Yrs and Yjs compatible collaborative data structures in MoonBit (in development)

    Download zip
    Author
    Version
    0.1.1
    License
    MIT
    Last updated
    10 hours ago
    Downloads
    4

    #Yrs for MoonBit

    Collaborative text, rich text, arrays, maps and XML in MoonBit, ported from Yrs. Implements the public CRDT capabilities of Yrs 0.28.0, including its weak-reference extension, with Yjs v1/v2 wire formats. The release target is complete CRDT compatibility with documented adaptations; Rust ownership/locking APIs and reproduced upstream bugs are not compatibility requirements. The implementation audit and all 13 release suites pass.

    #Installation

    moon add bobzhang/yrs@0.1.1

    #Replicate concurrent edits

    ///|
    test "two replicas exchange concurrent edits" {
    let a = @yrs.Doc(client_id=1UL)
    let b = @yrs.Doc(client_id=2UL)
    let left = a.get_or_insert_text("note")
    let right = b.get_or_insert_text("note")
    left.insert(0, "Hello")
    b.apply_update_v1(a.encode_state_as_update_v1())
    left.insert(5, " Moon")
    right.insert(5, " Rust")
    a.apply_update_v1(b.encode_state_as_update_v1(remote=a.state_vector()))
    b.apply_update_v1(a.encode_state_as_update_v1(remote=b.state_vector()))
    assert_eq(left.get_string(), "Hello Moon Rust")
    assert_eq(left.get_string(), right.get_string())
    }

    #Supported capabilities

    • Nested shared arrays, maps, text, rich-text formatting/embeds, XML fragments, elements, attributes and XML text; detached copies and replayable deltas.
    • State vectors, v1/v2 updates, merge/diff/conversion, out-of-order and duplicate delivery, pending-data inspection/pruning, deletion sets and garbage collection.
    • Transactions with origins, shallow/deep observers and incremental update packets.
    • Undo/redo with capture policies, origins, metadata and restorable stacks; snapshots, historical rich-text diffs, attribution and relative cursor positions.
    • Weak references and quoted ranges, typed root/nested handles, JSONPath queries, subdocument lifecycle, awareness and extensible sync/authentication protocols.
    • Open serialization, preliminary-value and binary-codec traits for applications.

    All CRDT code runs on JavaScript, native, Wasm and Wasm GC. Host applications provide transport, scheduling, time and identity generation.

    #Resolve a shared handle on another replica

    ///|
    test "resolve a typed collection on another replica" {
    let source = @yrs.Doc(client_id=1UL)
    let root : @yrs.Root[@yrs.MapRef] = Root("workspace")
    let map = root.get_or_create(source)
    let text = map.insert_text("title")
    text.insert(0, "Hello")
    let handle = text.hook()
    let peer = @yrs.Doc(client_id=2UL)
    peer.apply_update_v2(source.encode_state_as_update_v2())
    assert_eq(handle.get(peer).unwrap().get_string(), "Hello")
    map.remove("title")
    peer.apply_update_v1(source.encode_state_as_update_v1())
    assert_true(handle.get(peer) is None)
    }

    #Integration contract

    Use a unique Doc(client_id=...) for each active writer. For Rust/Yjs peers, keep client IDs in the 53-bit range (0 through 2^53 - 1). Transactions run within doc.transact(fn(tx) { ... }); direct collection methods also create transactions. Callbacks commit their edits even if the body raises: transactions do not roll back. Serialize access to a document in its host execution context.

    Observe Doc.observe_update_v1 or observe_update_v2 to send incremental packets. Forward updates generated during remote imports too: formatting cleanup and other causal changes can generate new operations. Duplicate delivery is safe. Persist encode_state_as_update_v1/v2; replicate subdocument contents separately.

    Defaults are UTF-16 offsets and retained deleted content (skip_gc=true). Use offset_kind=Bytes, skip_gc=false for Rust's defaults. Snapshot reconstruction requires retained content. Observers have explicit subscription keys and cancellation.

    See COMPATIBILITY.md for exact adaptations and the API contract for the disposition of every pinned public declaration/member. Corrections to upstream behavior have retained reproductions. Yrs weak links are an upstream extension; their semantics are checked against Rust, not Yjs 13.

    The 0.1.1 follow-up fixes gaps found by a fresh Codex CLI review: typed v2 rich-text values, sparse relays and history, ghost weak subscriptions, and retained observer transactions. See the review and issue dispositions.

    #Validation

    196 tests pass on all four backends. Differential tests use unchanged Yrs at ac339600c712642e556895426113c3f9c117de39 and pinned Yjs 13.6.27. The core matrix covers 641 scenarios across both wire formats and GC modes. Mixed MoonBit/Yjs undo tests check rendered content, state vectors, deletion ranges, notifications and persistence on JavaScript and native. The observer-only network matrix checks 128 histories per backend with shuffled packets and duplicates.

    The sparse oracle requires each receiver to reach the independent Rust causal fixed point without resending packets. Weak-reference tests check current visible quote boundaries independently, then replay identical wire histories to compare views and notifications. Known reference failures remain explicit assertions; passing a supported-contract gate is not a claim of exact Rust bug parity.

    Reproduction instructions describe all release suites. validation/release-*-results.json records the library source hash and command outcomes; detailed oracle reports record counts and reference exceptions. Historical development measurements are retained in validation/DEVELOPMENT_HISTORY.md.

    #Performance and limits

    Correctness compatibility does not imply performance parity. The last full native benchmark on the largest GC-enabled editing trace measured about 120 seconds and 117 MiB peak RSS for MoonBit versus 12.9 seconds and 93 MiB for Rust. Those measurements predate the final correctness fixes; see the exact revisions and whole-process methodology in the native report. The JavaScript report is recorded separately.

    Collection positions use MoonBit Int; binary clocks retain the full UInt32 range. Decoder resource limits and host memory still apply. This initial release has extensive interoperability tests, not a claim of exhaustive verification, unrestricted native thread safety or production deployment history.

    #License

    MIT; upstream notices are retained in LICENSE.

    Delta

    type Delta = DeltaOf[Out]

    A text edit with an application-selected insertion value. Delta and TextDelta specialize this type to observed Out values and detached In values.

    TextDelta

    type TextDelta = DeltaOf[In]

    Input delta for Text::apply_delta. Retain/delete lengths use the document's offset mode; inserted strings become text and other values become embeds.

    AsPrelim

    pub(open) trait AsPrelim {
    fn to_input(Self) -> In
    }

    Capture a value as detached input that can initialize a new shared value. This is the MoonBit form of Yrs's AsPrelim: the associated preliminary types are represented by In. Shared collections are deep copies; weak links retain their source identities, and subdocuments retain their GUID/options without copying their separately synchronized contents.

    AsyncProtocol

    pub(open) trait AsyncProtocol {
    async fn start(Self, Awareness) -> Bytes = _
    async fn handle(Self, Awareness, Bytes) -> Array[Message] = _
    async fn handle_message(Self, Awareness, Message) -> Message? = _
    async fn handle_sync_step1(Self, Awareness, StateVector) -> Message? = _
    async fn handle_sync_step2(Self, Awareness, Update) -> Message? = _
    async fn handle_update(Self, Awareness, Update) -> Message? = _
    async fn handle_auth(Self, Awareness, String?) -> Message? = _
    async fn handle_awareness_query(Self, Awareness) -> Message? = _
    async fn handle_awareness_update(Self, Awareness, AwarenessUpdate) -> Message? = _
    async fn missing_handle(Self, Awareness, Byte, Bytes) -> Message? = _
    }

    Asynchronous y-sync dispatch. Host callbacks may suspend for authentication or transport work; document mutations remain synchronous within each handler.

    Decode

    pub(open) trait Decode {
    fn decode(&Decoder) -> Self raise DecodeError
    fn decode_v1(Bytes) -> Self raise DecodeError = _
    fn decode_v2(Bytes) -> Self raise DecodeError = _
    }

    Decoder

    pub(open) trait Decoder : Read {
    fn reset_ds_cur_val(Self) -> Unit
    fn read_to_end(Self) -> Bytes
    fn read_ds_clock(Self) -> UInt raise DecodeError
    fn read_ds_len(Self) -> UInt raise DecodeError
    fn read_left_id(Self) -> Id raise DecodeError
    fn read_right_id(Self) -> Id raise DecodeError
    fn read_client(Self) -> UInt64 raise DecodeError
    fn read_info(Self) -> Byte raise DecodeError
    fn read_parent_info(Self) -> Bool raise DecodeError
    fn read_type_ref(Self) -> Byte raise DecodeError
    fn read_len(Self) -> UInt raise DecodeError
    fn read_any(Self) -> Any raise DecodeError
    fn read_json(Self) -> Any raise DecodeError
    fn read_key(Self) -> String raise DecodeError
    }

    Update-format input. read_to_end snapshots the remaining raw stream without advancing it, matching the pinned Yrs implementation.

    DefaultPrelim

    pub(open) trait DefaultPrelim : SharedRef {
    fn default_prelim() -> In
    fn from_out(Out) -> Self?
    }

    Shared types that can be initialized without additional configuration. from_out must accept the value produced by default_prelim.

    Encode

    pub(open) trait Encode {
    fn encode(Self, &Encoder) -> Unit
    fn encode_v1(Self) -> Bytes raise DecodeError = _
    fn encode_v2(Self) -> Bytes raise DecodeError = _
    }

    Application-defined values composed from update codec fields.

    Encoder

    pub(open) trait Encoder : Write {
    fn to_bytes(Self) -> Bytes raise DecodeError
    fn reset_ds_cur_val(Self) -> Unit
    fn write_ds_clock(Self, UInt) -> Unit
    fn write_ds_len(Self, UInt) -> Unit
    fn write_left_id(Self, Id) -> Unit
    fn write_right_id(Self, Id) -> Unit
    fn write_client(Self, UInt64) -> Unit
    fn write_info(Self, Byte) -> Unit
    fn write_parent_info(Self, Bool) -> Unit
    fn write_type_ref(Self, Byte) -> Unit
    fn write_len(Self, UInt) -> Unit
    fn write_any(Self, Any) -> Unit
    fn write_json(Self, Any) -> Unit
    fn write_key(Self, String) -> Unit
    }

    Update-format output, including v2 compression columns. Implementations can customize field encoding without changing application Encode instances.

    FromAny

    pub(open) trait FromAny {
    fn from_any(Any) -> Self raise ValueDecodeError
    }

    Application-defined deserialization from lib0 values, without an intermediate JSON conversion. Implement this for structured application types.
    impl FromAny for Unit
    impl FromAny for Bool
    impl FromAny for Int
    impl FromAny for Int64
    impl FromAny for UInt
    impl FromAny for UInt64
    impl FromAny for Float
    impl FromAny for Double
    impl FromAny for String
    impl FromAny for Option[T]
    impl FromAny for Bytes
    impl FromAny for Array[T]
    impl FromAny for Map[String, T]
    impl FromAny for Tuple2[A, B]

    FromOut

    pub(open) trait FromOut {
    fn try_from_out(Out) -> Result[Self, Out]
    }

    Direct conversion of an output value, preserving the original value on failure. Unlike FromAny deserialization, Rust-compatible integer casts to Int and UInt retain the low 32 bits instead of rejecting narrowing.
    impl FromOut for Bool
    impl FromOut for Int
    impl FromOut for Int64
    impl FromOut for UInt
    impl FromOut for Float
    impl FromOut for Double
    impl FromOut for String
    impl FromOut for Bytes

    Protocol

    pub(open) trait Protocol {
    fn start(Self, Awareness) -> Bytes raise = _
    fn handle(Self, Awareness, Bytes) -> Array[Message] raise = _
    fn handle_message(Self, Awareness, Message) -> Message? raise = _
    fn handle_sync_step1(Self, Awareness, StateVector) -> Message? raise = _
    fn handle_sync_step2(Self, Awareness, Update) -> Message? raise = _
    fn handle_update(Self, Awareness, Update) -> Message? raise = _
    fn handle_auth(Self, Awareness, String?) -> Message? raise = _
    fn handle_awareness_query(Self, Awareness) -> Message? raise = _
    fn handle_awareness_update(Self, Awareness, AwarenessUpdate) -> Message? raise = _
    fn missing_handle(Self, Awareness, Byte, Bytes) -> Message? raise = _
    }

    Extensible y-sync dispatch. Override individual handlers while retaining the default handshake, ordered packet processing and update application.

    Read

    pub(open) trait Read {
    fn read_exact(Self, Int) -> Bytes raise DecodeError
    fn read_u8(Self) -> Byte raise DecodeError = _
    fn read_u16(Self) -> UInt16 raise DecodeError = _
    fn read_u32(Self) -> UInt raise DecodeError = _
    fn read_u32_be(Self) -> UInt raise DecodeError = _
    fn read_u64(Self) -> UInt64 raise DecodeError = _
    fn read_i64(Self) -> Int64 raise DecodeError = _
    fn read_f32(Self) -> Float raise DecodeError = _
    fn read_f64(Self) -> Double raise DecodeError = _
    fn read_var_uint(Self) -> UInt64 raise DecodeError = _
    fn read_var_int(Self) -> Int64 raise DecodeError = _
    fn read_var_signed(Self) -> (Int64, Bool) raise DecodeError = _
    fn read_buf(Self) -> Bytes raise DecodeError = _
    fn read_string(Self) -> String raise DecodeError = _
    }

    Extensible lib0 byte input. Implement read_exact; other methods have defaults. Fixed u16/u32 are little endian, other fixed numbers are big endian. Variable integers use explicit signed/unsigned methods rather than Rust generics.

    RootRef

    pub(open) trait RootRef : SharedRef {
    fn get_or_insert_root(Doc, String) -> Self
    fn type_ref() -> TypeRef
    fn root(String) -> Root[Self] = _
    }

    Shared collections that can be created at the document root.

    SharedRef

    pub(open) trait SharedRef {
    fn from_branch(Doc, BranchId) -> Self?
    fn hook(Self) -> Hook[Self]
    }

    Typed resolution of a live shared collection from a logical identity. Descriptors contain no document reference and can resolve on any replica.

    ToAny

    pub(open) trait ToAny {
    fn to_any(Self) -> Any raise ValueEncodeError
    }

    Serialize application data to lib0 values without passing through JSON. Implement this trait for records and variants using Object/Array/String. Map keys are restricted to String by the built-in implementation.
    impl ToAny for Unit
    impl ToAny for Bool
    impl ToAny for Byte
    impl ToAny for Char
    impl ToAny for Int
    impl ToAny for Int64
    impl ToAny for UInt
    impl ToAny for UInt16
    impl ToAny for UInt64
    impl ToAny for Float
    impl ToAny for Double
    impl ToAny for String
    impl ToAny for Option[T]
    impl ToAny for ReadOnlyArray[T]
    impl ToAny for Bytes
    impl ToAny for Array[T]
    impl ToAny for Map[String, T]
    impl ToAny for Tuple2[A, B]

    Write

    pub(open) trait Write {
    fn write_all(Self, Bytes) -> Unit
    fn write_u8(Self, Byte) -> Unit = _
    fn write_u16(Self, UInt16) -> Unit = _
    fn write_u32(Self, UInt) -> Unit = _
    fn write_u32_be(Self, UInt) -> Unit = _
    fn write_u64(Self, UInt64) -> Unit = _
    fn write_i64(Self, Int64) -> Unit = _
    fn write_f32(Self, Float) -> Unit = _
    fn write_f64(Self, Double) -> Unit = _
    fn write_var_uint(Self, UInt64) -> Unit = _
    fn write_var_int(Self, Int64) -> Unit = _
    fn write_var_signed(Self, (Int64, Bool)) -> Unit = _
    fn write_buf(Self, Bytes) -> Unit = _
    fn write_string(Self, String) -> Unit = _
    }

    Extensible lib0 byte output. Implement write_all; defaults build on it. write_var_signed accepts (value, negative), preserving negative zero.

    AwarenessError

    pub suberror AwarenessError {
    ClientNotFound(UInt64)
    } derive(
    Debug
    )

    DecodeError

    pub(all) suberror DecodeError {
    InvalidData(String)
    } derive(
    Debug
    )

    JsonPathError

    pub suberror JsonPathError {
    InvalidJsonPath(String)
    } derive(
    Debug
    )

    ProtocolError

    pub(all) suberror ProtocolError {
    PermissionDenied(String)
    UnsupportedMessage(Byte)
    } derive(
    Debug
    )

    QuoteError

    pub(all) suberror QuoteError {
    OutOfBounds
    } derive(
    Debug
    )

    ValueDecodeError

    pub(all) suberror ValueDecodeError {
    TypeMismatch(String)
    OutOfRange(String)
    } derive(
    Debug
    )

    Type conversion failures for the lossless CRDT value decoder.

    ValueEncodeError

    pub(all) suberror ValueEncodeError {
    UnrepresentableInt
    Custom(String)
    } derive(
    Debug
    )

    Any

    pub(all) enum Any {
    Undefined
    Null
    Bool(Bool)
    Integer(Int64)
    Float(Double)
    String(String)
    Array(ReadOnlyArray[Any])
    Object(ReadOnlyArray[(String, Any)])
    Buffer(Bytes)
    } derive(
    Debug
    )

    Immutable lib0 values. Arrays and objects use read-only storage so values cannot be changed behind the CRDT's back after insertion.
    impl AsPrelim for Any
    impl FromAny for Any
    impl ToAny for Any
    impl Eq for Any

    Any::cast

    fn[T : FromOut] Any::cast(self : Any) -> Result[T, Any]

    Direct cast with Rust-compatible numeric narrowing. A rejected cast returns the original value; checked application deserialization uses from_any instead.

    Any::decode

    fn Any::decode(bytes : Bytes) -> Any raise DecodeError

    Any::decode_from

    fn Any::decode_from(reader : &Read, max_values? : Int) -> Any raise DecodeError

    Decode one value and leave the following bytes available to the reader. The value budget bounds compressed container expansion before iteration.

    Any::encode

    fn Any::encode(self : Any) -> Bytes

    Any::encode_to

    fn Any::encode_to(self : Any, writer : &Write) -> Unit

    Encode one lib0 value through an application-supplied byte writer. Large integers retain exact bits, as with Any.encode, rather than selecting Rust's potentially lossy floating representation at the Int64 endpoints.

    Any::equal

    fn Any::equal(self : Any, other : Any) -> Bool

    Any::from_any

    fn Any::from_any(value : Any) -> Any raise ValueDecodeError

    Any::from_json

    fn Any::from_json(value : Json) -> Any

    Any::json_path

    fn Any::json_path(self : Any, path : JsonPath) -> Iter[Any]

    Any::not_equal

    fn Any::not_equal(x : Any, y : Any) -> Bool

    Any::to_any

    fn Any::to_any(self : Any) -> Any raise ValueEncodeError

    Any::to_input

    fn Any::to_input(self : Any) -> In

    Any::to_json

    fn Any::to_json(self : Any) -> Json

    JSON projection. Undefined becomes null and buffers become byte arrays. Use the binary codec to preserve these distinctions and exact wide integers.

    Any::to_repr

    Any::to_string

    fn Any::to_string(self : Any) -> String

    Any::try_into_iter

    fn Any::try_into_iter(self : Any) -> Iter[(String?, Any)]?

    Ownership is managed by MoonBit; this has the same behavior as try_iter.

    Any::try_iter

    fn Any::try_iter(self : Any) -> Iter[(String?, Any)]?

    Visit array elements with None keys or object entries with Some(key). Primitive values have no iterator. Returned values are owned snapshots.

    ArrayEvent

    pub struct ArrayEvent {
    // private fields
    }

    ArrayEvent::delta

    fn ArrayEvent::delta(self : ArrayEvent) -> ReadOnlyArray[Change]

    ArrayEvent::inserts

    fn ArrayEvent::inserts(self : ArrayEvent) -> ReadOnlyArray[Id]

    IDs of inserted blocks, before post-transaction block compaction.

    ArrayEvent::path

    fn ArrayEvent::path(self : ArrayEvent) -> ReadOnlyArray[PathSegment]

    ArrayEvent::removes

    fn ArrayEvent::removes(self : ArrayEvent) -> ReadOnlyArray[Id]

    ArrayEvent::target

    fn ArrayEvent::target(self : ArrayEvent) -> ArrayRef

    ArrayRef

    pub struct ArrayRef {
    // private fields
    }

    impl FromOut for ArrayRef
    impl RootRef for ArrayRef
    impl Eq for ArrayRef

    ArrayRef::default_prelim

    fn ArrayRef::default_prelim() -> In

    ArrayRef::equal

    fn ArrayRef::equal(self : ArrayRef, other : ArrayRef) -> Bool

    ArrayRef::from_branch

    fn ArrayRef::from_branch(doc : Doc, id : BranchId) -> ArrayRef?

    ArrayRef::from_out

    fn ArrayRef::from_out(value : Out) -> ArrayRef?

    ArrayRef::get

    fn ArrayRef::get(self : ArrayRef, index : Int) -> Out?

    ArrayRef::get_as

    fn[T : FromAny] ArrayRef::get_as(self : ArrayRef, index : Int) -> T raise ValueDecodeError

    ArrayRef::get_json_as

    ArrayRef::get_or_insert_root

    fn ArrayRef::get_or_insert_root(doc : Doc, name : String) -> ArrayRef

    ArrayRef::hook

    fn ArrayRef::hook(self : ArrayRef) -> Hook[ArrayRef]

    ArrayRef::insert

    fn ArrayRef::insert(self : ArrayRef, index : Int, input : In) -> Out

    ArrayRef::insert_array

    fn ArrayRef::insert_array(self : ArrayRef, index : Int) -> ArrayRef

    ArrayRef::insert_doc

    fn ArrayRef::insert_doc(self : ArrayRef, index : Int, child : Doc) -> Doc

    ArrayRef::insert_map

    fn ArrayRef::insert_map(self : ArrayRef, index : Int) -> MapRef

    ArrayRef::insert_range

    fn ArrayRef::insert_range(self : ArrayRef, index : Int, values : Array[Any]) -> Unit

    ArrayRef::insert_text

    fn ArrayRef::insert_text(self : ArrayRef, index : Int) -> Text

    ArrayRef::iter

    fn ArrayRef::iter(self : ArrayRef) -> Iter[Out]

    ArrayRef::length

    fn ArrayRef::length(self : ArrayRef) -> Int

    ArrayRef::not_equal

    fn ArrayRef::not_equal(x : ArrayRef, y : ArrayRef) -> Bool

    ArrayRef::observe

    fn ArrayRef::observe(self : ArrayRef, key : String, callback : (ArrayEvent, Transaction) -> Unit) -> Unit

    ArrayRef::observe_deep

    fn ArrayRef::observe_deep(self : ArrayRef, key : String, callback : (ReadOnlyArray[Event], Transaction) -> Unit) -> Unit

    ArrayRef::push_back

    fn ArrayRef::push_back(self : ArrayRef, value : In) -> Out

    ArrayRef::push_front

    fn ArrayRef::push_front(self : ArrayRef, value : In) -> Out

    ArrayRef::quote

    fn ArrayRef::quote(self : ArrayRef, start : QuoteBound, end : QuoteBound) -> WeakPrelim raise QuoteError

    ArrayRef::remove

    fn ArrayRef::remove(self : ArrayRef, index : Int) -> Unit

    ArrayRef::remove_range

    fn ArrayRef::remove_range(self : ArrayRef, index : Int, length : Int) -> Unit

    ArrayRef::root

    fn ArrayRef::root(name : String) -> Root[ArrayRef]

    ArrayRef::sticky_boundary

    fn ArrayRef::sticky_boundary(self : ArrayRef, assoc? : Assoc) -> StickyIndex

    Track the start or end of this shared sequence, including an empty sequence.

    ArrayRef::sticky_index

    fn ArrayRef::sticky_index(self : ArrayRef, index : Int, assoc? : Assoc) -> StickyIndex?

    Track a position using CRDT identity. After at the end returns None, matching Yrs; use a Root/Nested StickyIndex to explicitly track a type boundary.

    ArrayRef::to_array

    fn ArrayRef::to_array(self : ArrayRef) -> Array[Out]

    ArrayRef::to_input

    fn ArrayRef::to_input(self : ArrayRef) -> In

    ArrayRef::to_json

    fn ArrayRef::to_json(self : ArrayRef) -> Json

    ArrayRef::try_from_out

    fn ArrayRef::try_from_out(value : Out) -> Result[ArrayRef, Out]

    ArrayRef::type_ref

    fn ArrayRef::type_ref() -> TypeRef

    ArrayRef::unobserve

    fn ArrayRef::unobserve(self : ArrayRef, key : String) -> Bool

    ArrayRef::unobserve_deep

    fn ArrayRef::unobserve_deep(self : ArrayRef, key : String) -> Bool

    Assoc

    pub(all) enum Assoc {
    Before
    After
    } derive(Eq,
    Debug
    )

    impl Decode for Assoc
    impl Encode for Assoc

    Assoc::decode

    fn Assoc::decode(decoder : &Decoder) -> Assoc raise DecodeError

    Assoc::decode_v1

    fn Assoc::decode_v1(bytes : Bytes) -> Assoc raise DecodeError

    Assoc::decode_v2

    fn Assoc::decode_v2(bytes : Bytes) -> Assoc raise DecodeError

    Assoc::encode

    fn Assoc::encode(self : Assoc, encoder : &Encoder) -> Unit

    Assoc::encode_v1

    fn Assoc::encode_v1(self : Assoc) -> Bytes raise DecodeError

    Assoc::encode_v2

    fn Assoc::encode_v2(self : Assoc) -> Bytes raise DecodeError

    Assoc::equal

    fn Assoc::equal(Assoc, Assoc) -> Bool

    Assoc::not_equal

    fn Assoc::not_equal(x : Assoc, y : Assoc) -> Bool

    Assoc::to_repr

    AttrRange

    pub(all) struct AttrRange[A] {
    start : UInt
    end : UInt
    attrs : ContentAttributes[A]
    } derive(Eq,
    Debug
    )

    An attributed half-open clock interval. The client is carried by IdMap.

    AttrRange::AttrRange

    fn[A] AttrRange::AttrRange(start : UInt, end : UInt, attrs? : ContentAttributes[A]) -> AttrRange[A]

    AttrRange::equal

    fn[A : Eq] AttrRange::equal(AttrRange[A], AttrRange[A]) -> Bool

    AttrRange::not_equal

    fn[A : Eq] AttrRange::not_equal(x : AttrRange[A], y : AttrRange[A]) -> Bool

    Awareness

    pub struct Awareness {
    // private fields
    }

    Ephemeral presence state. Supply the host clock in milliseconds so the same implementation works in browsers, native programs and deterministic tests.

    Awareness::Awareness

    fn Awareness::Awareness(doc : Doc, clock~ : () -> UInt64) -> Awareness

    Awareness::apply_update

    fn Awareness::apply_update(self : Awareness, update : AwarenessUpdate, origin? : Bytes) -> AwarenessSummary?

    Awareness::clean_local_state

    fn Awareness::clean_local_state(self : Awareness) -> Unit

    Awareness::client_id

    fn Awareness::client_id(self : Awareness) -> UInt64

    Awareness::doc

    fn Awareness::doc(self : Awareness) -> Doc

    Awareness::entries

    fn Awareness::entries(self : Awareness) -> Array[(UInt64, AwarenessState)]

    Awareness::handle_message

    fn Awareness::handle_message(self : Awareness, message : Message) -> Message? raise

    Awareness::handle_sync

    fn Awareness::handle_sync(self : Awareness, bytes : Bytes) -> Array[Message] raise

    Process concatenated protocol messages in order. As upstream does, a later invalid message does not roll back messages already applied from the packet.

    Awareness::local_state

    fn Awareness::local_state(self : Awareness) -> Json?

    Awareness::local_state_raw

    fn Awareness::local_state_raw(self : Awareness) -> String?

    Awareness::meta

    fn Awareness::meta(self : Awareness, client : UInt64) -> (UInt, UInt64)?

    Awareness::on_change

    fn Awareness::on_change(self : Awareness, key : String, callback : (Awareness, AwarenessSummary, Bytes?) -> Unit) -> Unit

    Awareness::on_update

    fn Awareness::on_update(self : Awareness, key : String, callback : (Awareness, AwarenessSummary, Bytes?) -> Unit) -> Unit

    Awareness::remove_state

    fn Awareness::remove_state(self : Awareness, client : UInt64) -> Unit

    Awareness::set_local_state

    fn Awareness::set_local_state(self : Awareness, state : Json) -> Unit

    Awareness::set_local_state_raw

    fn Awareness::set_local_state_raw(self : Awareness, json : String) -> Unit

    Awareness::start_sync

    fn Awareness::start_sync(self : Awareness) -> Bytes

    Encode the default y-sync handshake (state vector and live awareness).

    Awareness::state

    fn Awareness::state(self : Awareness, client : UInt64) -> Json?

    Awareness::state_raw

    fn Awareness::state_raw(self : Awareness, client : UInt64) -> String?

    Awareness::unobserve_change

    fn Awareness::unobserve_change(self : Awareness, key : String) -> Bool

    Awareness::unobserve_update

    fn Awareness::unobserve_update(self : Awareness, key : String) -> Bool

    Awareness::update

    fn Awareness::update(self : Awareness) -> AwarenessUpdate

    Awareness::update_with_clients

    fn Awareness::update_with_clients(self : Awareness, clients : Array[UInt64]) -> AwarenessUpdate raise AwarenessError

    AwarenessEntry

    pub(all) struct AwarenessEntry {
    clock : UInt
    json : String
    } derive(Eq,
    Debug
    )

    AwarenessEntry::equal

    AwarenessEntry::not_equal

    fn AwarenessEntry::not_equal(x : AwarenessEntry, y : AwarenessEntry) -> Bool

    AwarenessState

    pub(all) struct AwarenessState {
    clock : UInt
    last_updated : UInt64
    data : String?
    } derive(Eq,
    Debug
    )

    AwarenessState::equal

    AwarenessState::not_equal

    fn AwarenessState::not_equal(x : AwarenessState, y : AwarenessState) -> Bool

    AwarenessSummary

    pub(all) struct AwarenessSummary {
    added : ReadOnlyArray[UInt64]
    updated : ReadOnlyArray[UInt64]
    removed : ReadOnlyArray[UInt64]
    } derive(Eq,
    Debug
    )

    AwarenessSummary::all_changes

    fn AwarenessSummary::all_changes(self : AwarenessSummary) -> Array[UInt64]

    AwarenessSummary::equal

    AwarenessSummary::not_equal

    fn AwarenessSummary::not_equal(x : AwarenessSummary, y : AwarenessSummary) -> Bool

    AwarenessUpdate

    pub struct AwarenessUpdate {
    // private fields
    }

    AwarenessUpdate::AwarenessUpdate

    fn AwarenessUpdate::AwarenessUpdate(entries? : Array[(UInt64, AwarenessEntry)]) -> AwarenessUpdate

    AwarenessUpdate::decode_v1

    fn AwarenessUpdate::decode_v1(bytes : Bytes) -> AwarenessUpdate raise DecodeError

    AwarenessUpdate::encode_v1

    fn AwarenessUpdate::encode_v1(self : AwarenessUpdate) -> Bytes

    AwarenessUpdate::entries

    fn AwarenessUpdate::entries(self : AwarenessUpdate) -> Array[(UInt64, AwarenessEntry)]

    BlockRange

    pub(all) struct BlockRange {
    client : UInt64
    clock : UInt
    length : UInt
    } derive(Eq,
    Debug
    )

    A contiguous interval of identities from one client.

    BlockRange::BlockRange

    fn BlockRange::BlockRange(client : UInt64, clock : UInt, length : UInt) -> BlockRange

    BlockRange::clock_end

    fn BlockRange::clock_end(self : BlockRange) -> UInt

    BlockRange::clock_range

    fn BlockRange::clock_range(self : BlockRange) -> (UInt, UInt)

    Half-open clock interval represented as (start, end).

    BlockRange::contains

    fn BlockRange::contains(self : BlockRange, id : Id) -> Bool

    BlockRange::equal

    fn BlockRange::equal(BlockRange, BlockRange) -> Bool

    BlockRange::id

    fn BlockRange::id(self : BlockRange) -> Id

    BlockRange::last_id

    fn BlockRange::last_id(self : BlockRange) -> Id

    The exclusive upper clock, matching the pinned Yrs method despite its name.

    BlockRange::not_equal

    fn BlockRange::not_equal(x : BlockRange, y : BlockRange) -> Bool

    BlockRange::slice

    fn BlockRange::slice(self : BlockRange, offset : UInt) -> BlockRange

    Drop offset clocks from the beginning. An offset equal to length is valid and produces an empty range; larger offsets are rejected.

    BranchId

    pub(all) enum BranchId {
    Nested(Id)
    Root(String)
    } derive(Eq, Hash,
    Debug
    )

    BranchId::equal

    fn BranchId::equal(BranchId, BranchId) -> Bool

    BranchId::from_json

    fn BranchId::from_json(value : Json) -> BranchId raise DecodeError

    BranchId::get

    fn BranchId::get(self : BranchId, doc : Doc) -> Out?

    BranchId::hash

    fn BranchId::hash(self : BranchId) -> Int

    BranchId::hash_combine

    fn BranchId::hash_combine(BranchId, Hasher) -> Unit

    BranchId::not_equal

    fn BranchId::not_equal(x : BranchId, y : BranchId) -> Bool

    BranchId::to_json

    fn BranchId::to_json(self : BranchId) -> Json

    Rust serde representation of a logical branch identity.

    BranchId::to_repr

    ByteWriter

    pub struct ByteWriter {
    // private fields
    }

    Growable lib0 output. to_bytes returns an owned snapshot without consuming it.
    impl Write for ByteWriter

    ByteWriter::ByteWriter

    fn ByteWriter::ByteWriter() -> ByteWriter

    ByteWriter::to_bytes

    fn ByteWriter::to_bytes(self : ByteWriter) -> Bytes

    ByteWriter::write_all

    fn ByteWriter::write_all(self : ByteWriter, bytes : Bytes) -> Unit

    ByteWriter::write_buf

    fn ByteWriter::write_buf(self : ByteWriter, bytes : Bytes) -> Unit

    ByteWriter::write_f32

    fn ByteWriter::write_f32(self : ByteWriter, value : Float) -> Unit

    ByteWriter::write_f64

    fn ByteWriter::write_f64(self : ByteWriter, value : Double) -> Unit

    ByteWriter::write_i64

    fn ByteWriter::write_i64(self : ByteWriter, value : Int64) -> Unit

    ByteWriter::write_string

    fn ByteWriter::write_string(self : ByteWriter, text : String) -> Unit

    ByteWriter::write_u16

    fn ByteWriter::write_u16(self : ByteWriter, value : UInt16) -> Unit

    ByteWriter::write_u32

    fn ByteWriter::write_u32(self : ByteWriter, value : UInt) -> Unit

    ByteWriter::write_u32_be

    fn ByteWriter::write_u32_be(self : ByteWriter, value : UInt) -> Unit

    ByteWriter::write_u64

    fn ByteWriter::write_u64(self : ByteWriter, value : UInt64) -> Unit

    ByteWriter::write_u8

    fn ByteWriter::write_u8(self : ByteWriter, byte : Byte) -> Unit

    ByteWriter::write_var_int

    fn ByteWriter::write_var_int(self : ByteWriter, value : Int64) -> Unit

    ByteWriter::write_var_signed

    fn ByteWriter::write_var_signed(self : ByteWriter, signed : (Int64, Bool)) -> Unit

    ByteWriter::write_var_uint

    fn ByteWriter::write_var_uint(self : ByteWriter, number : UInt64) -> Unit

    Change

    pub(all) enum Change {
    Added(ReadOnlyArray[Out])
    Removed(Int)
    Retain(Int)
    }

    Change::to_json

    fn Change::to_json(self : Change) -> Json

    ChangeKind

    pub(all) enum ChangeKind {
    Added
    Removed
    } derive(Eq,
    Debug
    )

    ChangeKind::equal

    fn ChangeKind::equal(ChangeKind, ChangeKind) -> Bool

    ChangeKind::not_equal

    fn ChangeKind::not_equal(x : ChangeKind, y : ChangeKind) -> Bool

    ContentAttribute

    pub(all) struct ContentAttribute[A] {
    name : String
    value : A
    } derive(Eq,
    Debug
    )

    A named attribution value attached to CRDT identities.

    ContentAttribute::ContentAttribute

    fn[A] ContentAttribute::ContentAttribute(name : String, value : A) -> ContentAttribute[A]

    ContentAttribute::equal

    fn[A : Eq] ContentAttribute::equal(ContentAttribute[A], ContentAttribute[A]) -> Bool

    ContentAttribute::not_equal

    fn[A : Eq] ContentAttribute::not_equal(x : ContentAttribute[A], y : ContentAttribute[A]) -> Bool

    ContentAttributes

    pub struct ContentAttributes[A] {
    // private fields
    } derive(
    Debug
    )

    Attribute equality is independent of order, as in Yrs.
    impl Eq for ContentAttributes[A]

    ContentAttributes::ContentAttributes

    fn[A] ContentAttributes::ContentAttributes(values? : Array[ContentAttribute[A]]) -> ContentAttributes[A]

    ContentAttributes::as_array

    fn[A] ContentAttributes::as_array(self : ContentAttributes[A]) -> Array[ContentAttribute[A]]

    ContentAttributes::equal

    fn[A : Eq] ContentAttributes::equal(self : ContentAttributes[A], other : ContentAttributes[A]) -> Bool

    ContentAttributes::length

    fn[A] ContentAttributes::length(self : ContentAttributes[A]) -> Int

    ContentAttributes::merge

    fn[A : Eq] ContentAttributes::merge(self : ContentAttributes[A], other : ContentAttributes[A]) -> ContentAttributes[A]

    ContentAttributes::not_equal

    fn[A : Eq] ContentAttributes::not_equal(x : ContentAttributes[A], y : ContentAttributes[A]) -> Bool

    Cursor

    pub struct Cursor {
    // private fields
    }

    Owned, bounds-checked lib0 input cursor. Failed fixed-width reads do not advance.
    impl Read for Cursor

    Cursor::Cursor

    fn Cursor::Cursor(bytes : Bytes) -> Cursor

    Cursor::has_content

    fn Cursor::has_content(self : Cursor) -> Bool

    Cursor::position

    fn Cursor::position(self : Cursor) -> Int

    Cursor::read_buf

    fn Cursor::read_buf(self : Cursor) -> Bytes raise DecodeError

    Cursor::read_exact

    fn Cursor::read_exact(self : Cursor, length : Int) -> Bytes raise DecodeError

    Cursor::read_f32

    fn Cursor::read_f32(self : Cursor) -> Float raise DecodeError

    Cursor::read_f64

    fn Cursor::read_f64(self : Cursor) -> Double raise DecodeError

    Cursor::read_i64

    fn Cursor::read_i64(self : Cursor) -> Int64 raise DecodeError

    Cursor::read_string

    fn Cursor::read_string(self : Cursor) -> String raise DecodeError

    Cursor::read_u16

    fn Cursor::read_u16(self : Cursor) -> UInt16 raise DecodeError

    Cursor::read_u32

    fn Cursor::read_u32(self : Cursor) -> UInt raise DecodeError

    Cursor::read_u32_be

    fn Cursor::read_u32_be(self : Cursor) -> UInt raise DecodeError

    Cursor::read_u64

    fn Cursor::read_u64(self : Cursor) -> UInt64 raise DecodeError

    Cursor::read_u8

    fn Cursor::read_u8(self : Cursor) -> Byte raise DecodeError

    Cursor::read_var_int

    fn Cursor::read_var_int(self : Cursor) -> Int64 raise DecodeError

    Cursor::read_var_signed

    fn Cursor::read_var_signed(self : Cursor) -> (Int64, Bool) raise DecodeError

    Cursor::read_var_uint

    fn Cursor::read_var_uint(self : Cursor) -> UInt64 raise DecodeError

    Cursor::remaining

    fn Cursor::remaining(self : Cursor) -> Int

    DecoderV1

    pub struct DecoderV1 {
    // private fields
    }

    lib0 v1 update decoder. Inputs are owned; returned buffers are snapshots.
    impl Read for DecoderV1

    DecoderV1::DecoderV1

    fn DecoderV1::DecoderV1(bytes : Bytes) -> DecoderV1

    DecoderV1::read_any

    fn DecoderV1::read_any(self : DecoderV1) -> Any raise DecodeError

    DecoderV1::read_buf

    fn DecoderV1::read_buf(self : DecoderV1) -> Bytes raise DecodeError

    DecoderV1::read_client

    fn DecoderV1::read_client(self : DecoderV1) -> UInt64 raise DecodeError

    DecoderV1::read_ds_clock

    fn DecoderV1::read_ds_clock(self : DecoderV1) -> UInt raise DecodeError

    DecoderV1::read_ds_len

    fn DecoderV1::read_ds_len(self : DecoderV1) -> UInt raise DecodeError

    DecoderV1::read_exact

    fn DecoderV1::read_exact(self : DecoderV1, length : Int) -> Bytes raise DecodeError

    DecoderV1::read_f32

    fn DecoderV1::read_f32(self : DecoderV1) -> Float raise DecodeError

    DecoderV1::read_f64

    fn DecoderV1::read_f64(self : DecoderV1) -> Double raise DecodeError

    DecoderV1::read_i64

    fn DecoderV1::read_i64(self : DecoderV1) -> Int64 raise DecodeError

    DecoderV1::read_info

    fn DecoderV1::read_info(self : DecoderV1) -> Byte raise DecodeError

    DecoderV1::read_json

    fn DecoderV1::read_json(self : DecoderV1) -> Any raise DecodeError

    DecoderV1::read_key

    fn DecoderV1::read_key(self : DecoderV1) -> String raise DecodeError

    DecoderV1::read_left_id

    fn DecoderV1::read_left_id(self : DecoderV1) -> Id raise DecodeError

    DecoderV1::read_len

    fn DecoderV1::read_len(self : DecoderV1) -> UInt raise DecodeError

    DecoderV1::read_parent_info

    fn DecoderV1::read_parent_info(self : DecoderV1) -> Bool raise DecodeError

    DecoderV1::read_right_id

    fn DecoderV1::read_right_id(self : DecoderV1) -> Id raise DecodeError

    DecoderV1::read_string

    fn DecoderV1::read_string(self : DecoderV1) -> String raise DecodeError

    DecoderV1::read_to_end

    fn DecoderV1::read_to_end(self : DecoderV1) -> Bytes

    DecoderV1::read_type_ref

    fn DecoderV1::read_type_ref(self : DecoderV1) -> Byte raise DecodeError

    DecoderV1::read_u16

    fn DecoderV1::read_u16(self : DecoderV1) -> UInt16 raise DecodeError

    DecoderV1::read_u32

    fn DecoderV1::read_u32(self : DecoderV1) -> UInt raise DecodeError

    DecoderV1::read_u32_be

    fn DecoderV1::read_u32_be(self : DecoderV1) -> UInt raise DecodeError

    DecoderV1::read_u64

    fn DecoderV1::read_u64(self : DecoderV1) -> UInt64 raise DecodeError

    DecoderV1::read_u8

    fn DecoderV1::read_u8(self : DecoderV1) -> Byte raise DecodeError

    DecoderV1::read_var_int

    fn DecoderV1::read_var_int(self : DecoderV1) -> Int64 raise DecodeError

    DecoderV1::read_var_signed

    fn DecoderV1::read_var_signed(self : DecoderV1) -> (Int64, Bool) raise DecodeError

    DecoderV1::read_var_uint

    fn DecoderV1::read_var_uint(self : DecoderV1) -> UInt64 raise DecodeError

    DecoderV1::reset_ds_cur_val

    fn DecoderV1::reset_ds_cur_val(_self : DecoderV1) -> Unit

    DecoderV2

    pub struct DecoderV2 {
    // private fields
    }

    lib0 v2 update decoder. Inputs are owned; returned buffers are snapshots.
    impl Read for DecoderV2

    DecoderV2::DecoderV2

    fn DecoderV2::DecoderV2(bytes : Bytes) -> DecoderV2 raise DecodeError

    DecoderV2::read_any

    fn DecoderV2::read_any(self : DecoderV2) -> Any raise DecodeError

    DecoderV2::read_buf

    fn DecoderV2::read_buf(self : DecoderV2) -> Bytes raise DecodeError

    DecoderV2::read_client

    fn DecoderV2::read_client(self : DecoderV2) -> UInt64 raise DecodeError

    DecoderV2::read_ds_clock

    fn DecoderV2::read_ds_clock(self : DecoderV2) -> UInt raise DecodeError

    DecoderV2::read_ds_len

    fn DecoderV2::read_ds_len(self : DecoderV2) -> UInt raise DecodeError

    DecoderV2::read_exact

    fn DecoderV2::read_exact(self : DecoderV2, length : Int) -> Bytes raise DecodeError

    DecoderV2::read_f32

    fn DecoderV2::read_f32(self : DecoderV2) -> Float raise DecodeError

    DecoderV2::read_f64

    fn DecoderV2::read_f64(self : DecoderV2) -> Double raise DecodeError

    DecoderV2::read_i64

    fn DecoderV2::read_i64(self : DecoderV2) -> Int64 raise DecodeError

    DecoderV2::read_info

    fn DecoderV2::read_info(self : DecoderV2) -> Byte raise DecodeError

    DecoderV2::read_json

    fn DecoderV2::read_json(self : DecoderV2) -> Any raise DecodeError

    DecoderV2::read_key

    fn DecoderV2::read_key(self : DecoderV2) -> String raise DecodeError

    DecoderV2::read_left_id

    fn DecoderV2::read_left_id(self : DecoderV2) -> Id raise DecodeError

    DecoderV2::read_len

    fn DecoderV2::read_len(self : DecoderV2) -> UInt raise DecodeError

    DecoderV2::read_parent_info

    fn DecoderV2::read_parent_info(self : DecoderV2) -> Bool raise DecodeError

    DecoderV2::read_right_id

    fn DecoderV2::read_right_id(self : DecoderV2) -> Id raise DecodeError

    DecoderV2::read_string

    fn DecoderV2::read_string(self : DecoderV2) -> String raise DecodeError

    DecoderV2::read_to_end

    fn DecoderV2::read_to_end(self : DecoderV2) -> Bytes

    DecoderV2::read_type_ref

    fn DecoderV2::read_type_ref(self : DecoderV2) -> Byte raise DecodeError

    DecoderV2::read_u16

    fn DecoderV2::read_u16(self : DecoderV2) -> UInt16 raise DecodeError

    DecoderV2::read_u32

    fn DecoderV2::read_u32(self : DecoderV2) -> UInt raise DecodeError

    DecoderV2::read_u32_be

    fn DecoderV2::read_u32_be(self : DecoderV2) -> UInt raise DecodeError

    DecoderV2::read_u64

    fn DecoderV2::read_u64(self : DecoderV2) -> UInt64 raise DecodeError

    DecoderV2::read_u8

    fn DecoderV2::read_u8(self : DecoderV2) -> Byte raise DecodeError

    DecoderV2::read_var_int

    fn DecoderV2::read_var_int(self : DecoderV2) -> Int64 raise DecodeError

    DecoderV2::read_var_signed

    fn DecoderV2::read_var_signed(self : DecoderV2) -> (Int64, Bool) raise DecodeError

    DecoderV2::read_var_uint

    fn DecoderV2::read_var_uint(self : DecoderV2) -> UInt64 raise DecodeError

    DecoderV2::reset_ds_cur_val

    fn DecoderV2::reset_ds_cur_val(self : DecoderV2) -> Unit

    DefaultProtocol

    pub struct DefaultProtocol {
    }

    DefaultProtocol::DefaultProtocol

    fn DefaultProtocol::DefaultProtocol() -> DefaultProtocol

    DefaultProtocol::handle

    fn DefaultProtocol::handle(self : DefaultProtocol, awareness : Awareness, bytes : Bytes) -> Array[Message] raise

    DefaultProtocol::handle_auth

    fn DefaultProtocol::handle_auth(_self : DefaultProtocol, _awareness : Awareness, reason : String?) -> Message? raise

    DefaultProtocol::handle_awareness_query

    fn DefaultProtocol::handle_awareness_query(_self : DefaultProtocol, awareness : Awareness) -> Message? raise

    DefaultProtocol::handle_awareness_update

    fn DefaultProtocol::handle_awareness_update(_self : DefaultProtocol, awareness : Awareness, update : AwarenessUpdate) -> Message? raise

    DefaultProtocol::handle_message

    fn DefaultProtocol::handle_message(self : DefaultProtocol, awareness : Awareness, message : Message) -> Message? raise

    DefaultProtocol::handle_sync_step1

    fn DefaultProtocol::handle_sync_step1(_self : DefaultProtocol, awareness : Awareness, remote : StateVector) -> Message? raise

    DefaultProtocol::handle_sync_step2

    fn DefaultProtocol::handle_sync_step2(_self : DefaultProtocol, awareness : Awareness, update : Update) -> Message? raise

    DefaultProtocol::handle_update

    fn DefaultProtocol::handle_update(self : DefaultProtocol, awareness : Awareness, update : Update) -> Message? raise

    DefaultProtocol::missing_handle

    fn DefaultProtocol::missing_handle(_self : DefaultProtocol, _awareness : Awareness, tag : Byte, _bytes : Bytes) -> Message? raise

    DefaultProtocol::start

    fn DefaultProtocol::start(_self : DefaultProtocol, awareness : Awareness) -> Bytes raise

    DeltaOf

    pub(all) enum DeltaOf[T] {
    Inserted(T, ReadOnlyArray[(String, Any)])
    Deleted(Int)
    Retain(Int, ReadOnlyArray[(String, Any)])
    }

    A text edit with an application-selected insertion value. Delta and TextDelta specialize this type to observed Out values and detached In values.

    DeltaOf::delete

    fn DeltaOf::delete(length : Int) -> DeltaOf[In]

    DeltaOf::insert

    fn DeltaOf::insert(value : In) -> DeltaOf[In]

    DeltaOf::insert_with

    fn DeltaOf::insert_with(value : In, attributes : ReadOnlyArray[(String, Any)]) -> DeltaOf[In]

    DeltaOf::map

    fn[A, B] DeltaOf::map(self : DeltaOf[A], f : (A) -> B raise?) -> DeltaOf[B] raise?

    Transform an inserted value once, preserving lengths and formatting. Retain and delete operations do not invoke the callback.

    DeltaOf::retain

    fn DeltaOf::retain(length : Int) -> DeltaOf[In]

    DeltaOf::to_input

    fn DeltaOf::to_input(self : DeltaOf[Out]) -> DeltaOf[In]

    Copy inserted shared values into detached preliminary values for apply_delta.

    DeltaOf::to_json

    fn DeltaOf::to_json(self : DeltaOf[Out]) -> Json

    Diff

    pub(all) struct Diff[M] {
    insert : Out
    attributes : ReadOnlyArray[(String, Any)]
    ychange : M?
    }

    Doc

    pub struct Doc {
    // private fields
    }

    A document replica. Each independently edited replica must use a distinct client ID. This initial API uses Yjs UTF-16 positions and retains tombstones.
    impl FromOut for Doc
    impl Eq for Doc

    Doc::Doc

    fn Doc::Doc(client_id~ : UInt64, guid? : String, collection_id? : String, auto_load? : Bool, should_load? : Bool, offset_kind? : OffsetKind, skip_gc? : Bool, cleanup_formatting? : Bool) -> Doc

    Doc::apply_update

    fn Doc::apply_update(self : Doc, update : Update) -> Unit raise DecodeError

    Doc::apply_update_v1

    fn Doc::apply_update_v1(self : Doc, bytes : Bytes) -> Unit raise DecodeError

    Decode the entire update before mutating the document. Missing dependencies and early deletions remain pending and are retried on subsequent updates.

    Doc::apply_update_v2

    fn Doc::apply_update_v2(self : Doc, bytes : Bytes, max_items? : Int) -> Unit raise DecodeError

    Doc::auto_load

    fn Doc::auto_load(self : Doc) -> Bool

    Doc::branch_id

    fn Doc::branch_id(self : Doc) -> BranchId?

    Identity of this subdocument's owning item in its parent document.

    Doc::cleanup_formatting_enabled

    fn Doc::cleanup_formatting_enabled(self : Doc) -> Bool

    Whether remote transactions remove redundant rich-text format markers.

    Doc::client_id

    fn Doc::client_id(self : Doc) -> UInt64

    Doc::collection_id

    fn Doc::collection_id(self : Doc) -> String?

    Doc::destroy

    fn Doc::destroy(self : Doc) -> Unit

    Unload this handle. A live parent reference becomes a fresh, unloaded document with the same GUID; persisted subdocument data is not erased.

    Doc::encode_diff

    fn Doc::encode_diff(self : Doc, remote : StateVector, encoder : &Encoder) -> Unit

    Write integrated document changes to an application-supplied field codec. Pending blocks and early deletions are excluded, matching Rust's generic ReadTxn::encode_diff. Use the v1/v2 state-update helpers to forward pending data.

    Doc::encode_diff_v1

    fn Doc::encode_diff_v1(self : Doc, remote : StateVector) -> Bytes

    Encode integrated changes only. Pending blocks and early deletions are omitted.

    Doc::encode_diff_v2

    fn Doc::encode_diff_v2(self : Doc, remote : StateVector) -> Bytes raise DecodeError

    Doc::encode_state_as_update

    fn Doc::encode_state_as_update(self : Doc, remote : StateVector, encoder : &Encoder) -> Unit

    Write the integrated state through a generic encoder. Like pinned Rust's generic method, this omits pending data; its v1/v2 convenience methods also merge pending updates. The distinction matters for out-of-order delivery.

    Doc::encode_state_as_update_v1

    fn Doc::encode_state_as_update_v1(self : Doc, remote? : StateVector) -> Bytes

    Doc::encode_state_as_update_v2

    fn Doc::encode_state_as_update_v2(self : Doc, remote? : StateVector) -> Bytes raise DecodeError

    Doc::encode_state_from_snapshot

    fn Doc::encode_state_from_snapshot(self : Doc, snapshot : Snapshot, encoder : &Encoder) -> Unit raise DecodeError

    Write retained historical state through a generic encoder. GC must be off.

    Doc::encode_state_from_snapshot_v1

    fn Doc::encode_state_from_snapshot_v1(self : Doc, snapshot : Snapshot) -> Bytes raise DecodeError

    Reconstruct the snapshot using retained CRDT history. As with upstream, a snapshot cannot recover content already garbage-collected by another peer.

    Doc::encode_state_from_snapshot_v2

    fn Doc::encode_state_from_snapshot_v2(self : Doc, snapshot : Snapshot) -> Bytes raise DecodeError

    Doc::equal

    fn Doc::equal(self : Doc, other : Doc) -> Bool

    Doc::gc

    fn Doc::gc(self : Doc, delete_set? : IdSet) -> Unit

    Doc::get

    fn Doc::get(self : Doc, name : String) -> Out?

    Look up an existing root without creating or changing its declared type.

    Doc::get_array

    fn Doc::get_array(self : Doc, name : String) -> ArrayRef?

    Doc::get_map

    fn Doc::get_map(self : Doc, name : String) -> MapRef?

    Doc::get_or_insert_array

    fn Doc::get_or_insert_array(self : Doc, name : String) -> ArrayRef

    Doc::get_or_insert_map

    fn Doc::get_or_insert_map(self : Doc, name : String) -> MapRef

    Doc::get_or_insert_text

    fn Doc::get_or_insert_text(self : Doc, name : String) -> Text

    Doc::get_or_insert_xml_fragment

    fn Doc::get_or_insert_xml_fragment(self : Doc, name : String) -> XmlFragment

    Doc::get_text

    fn Doc::get_text(self : Doc, name : String) -> Text?

    Doc::get_type_from_path

    fn Doc::get_type_from_path(self : Doc, path : Array[PathSegment]) -> Out?

    Resolve a root-key path through shared maps and sequences, as Yrs Store does. Primitive values and subdocuments are not shared branches. Retained deleted map values can resolve; sequence indices count only visible values.

    Doc::get_xml_fragment

    fn Doc::get_xml_fragment(self : Doc, name : String) -> XmlFragment?

    Doc::guid

    fn Doc::guid(self : Doc) -> String

    Doc::has_missing_updates

    fn Doc::has_missing_updates(self : Doc) -> Bool

    Doc::has_pending_updates

    fn Doc::has_pending_updates(self : Doc) -> Bool

    Whether unresolved blocks or early deletions are queued, matching Yrs's pending-store check. has_missing_updates additionally detects clock gaps.

    Doc::json_path

    fn Doc::json_path(self : Doc, path : JsonPath) -> Iter[Out]

    Doc::load

    fn Doc::load(self : Doc) -> Unit

    Request loading locally. Providers observe the parent's loaded event and exchange this document's updates separately from the parent's updates.

    Doc::not_equal

    fn Doc::not_equal(x : Doc, y : Doc) -> Bool

    Doc::observe_after_transaction

    fn Doc::observe_after_transaction(self : Doc, key : String, callback : (Transaction) -> Unit) -> Unit

    Doc::observe_before_observer_calls

    fn Doc::observe_before_observer_calls(self : Doc, key : String, callback : (Transaction) -> Unit) -> Unit

    Doc::observe_destroy

    fn Doc::observe_destroy(self : Doc, key : String, callback : (Doc) -> Unit) -> Unit

    Doc::observe_subdocs

    fn Doc::observe_subdocs(self : Doc, key : String, callback : (SubdocsEvent, Transaction) -> Unit) -> Unit

    Doc::observe_transaction_cleanup

    fn Doc::observe_transaction_cleanup(self : Doc, key : String, callback : (Transaction) -> Unit) -> Unit

    Doc::observe_update_v1

    fn Doc::observe_update_v1(self : Doc, key : String, callback : (Bytes, Transaction) -> Unit) -> Unit

    Doc::observe_update_v2

    fn Doc::observe_update_v2(self : Doc, key : String, callback : (Bytes, Transaction) -> Unit) -> Unit

    Doc::offset_kind

    fn Doc::offset_kind(self : Doc) -> OffsetKind

    Doc::parent_doc

    fn Doc::parent_doc(self : Doc) -> Doc?

    Doc::pending_delete_set

    fn Doc::pending_delete_set(self : Doc) -> IdSet?

    Return an owned copy of deletion ranges whose items have not arrived yet. Reading this metadata does not start a transaction or notify observers.

    Doc::pending_items

    fn Doc::pending_items(self : Doc) -> Int

    Doc::pending_update

    fn Doc::pending_update(self : Doc) -> Update?

    Inspect unresolved item blocks without draining or retrying them. Pending deletions are exposed separately by pending_delete_set, as in Yrs Store.

    Doc::prune_pending

    fn Doc::prune_pending(self : Doc) -> Update?

    Remove unresolved blocks and deletions, returning an update that can be saved and applied later. Already integrated changes, including sparse ones, remain.

    Doc::ptr_eq

    fn Doc::ptr_eq(self : Doc, other : Doc) -> Bool

    Doc::root_refs

    fn Doc::root_refs(self : Doc) -> Array[(String, Out)]

    Doc::should_load

    fn Doc::should_load(self : Doc) -> Bool

    Doc::skip_gc

    fn Doc::skip_gc(self : Doc) -> Bool

    Doc::snapshot

    fn Doc::snapshot(self : Doc) -> Snapshot

    Capture every integrated item, including items beyond missing clock ranges. Snapshot clocks bound observed identities; absent ranges are excluded by its delete set. Use Doc::state_vector (not this snapshot's vector) for replication.

    Doc::state_vector

    fn Doc::state_vector(self : Doc) -> StateVector

    Doc::subdoc_guids

    fn Doc::subdoc_guids(self : Doc) ->
    Set
    [String]

    Doc::subdocs

    fn Doc::subdocs(self : Doc) -> Array[Doc]

    Doc::transact

    fn[T] Doc::transact(self : Doc, action : (Transaction) -> T raise, origin? : Bytes) -> T raise

    Group mutations into one commit and one update event. A raised error commits the edits already made, matching upstream transaction drop semantics.

    Doc::try_from_out

    fn Doc::try_from_out(value : Out) -> Result[Doc, Out]

    Doc::unobserve_after_transaction

    fn Doc::unobserve_after_transaction(self : Doc, key : String) -> Bool

    Doc::unobserve_before_observer_calls

    fn Doc::unobserve_before_observer_calls(self : Doc, key : String) -> Bool

    Doc::unobserve_destroy

    fn Doc::unobserve_destroy(self : Doc, key : String) -> Bool

    Doc::unobserve_subdocs

    fn Doc::unobserve_subdocs(self : Doc, key : String) -> Bool

    Doc::unobserve_transaction_cleanup

    fn Doc::unobserve_transaction_cleanup(self : Doc, key : String) -> Bool

    Doc::unobserve_update_v1

    fn Doc::unobserve_update_v1(self : Doc, key : String) -> Bool

    Doc::unobserve_update_v2

    fn Doc::unobserve_update_v2(self : Doc, key : String) -> Bool

    EncoderV1

    pub struct EncoderV1 {
    // private fields
    }

    lib0 v1 update encoder. to_bytes snapshots without consuming the encoder.
    impl Write for EncoderV1

    EncoderV1::EncoderV1

    fn EncoderV1::EncoderV1() -> EncoderV1

    EncoderV1::reset_ds_cur_val

    fn EncoderV1::reset_ds_cur_val(_self : EncoderV1) -> Unit

    EncoderV1::to_bytes

    fn EncoderV1::to_bytes(self : EncoderV1) -> Bytes raise DecodeError

    EncoderV1::write_all

    fn EncoderV1::write_all(self : EncoderV1, bytes : Bytes) -> Unit

    EncoderV1::write_any

    fn EncoderV1::write_any(self : EncoderV1, value : Any) -> Unit

    EncoderV1::write_buf

    fn EncoderV1::write_buf(self : EncoderV1, bytes : Bytes) -> Unit

    EncoderV1::write_client

    fn EncoderV1::write_client(self : EncoderV1, value : UInt64) -> Unit

    EncoderV1::write_ds_clock

    fn EncoderV1::write_ds_clock(self : EncoderV1, value : UInt) -> Unit

    EncoderV1::write_ds_len

    fn EncoderV1::write_ds_len(self : EncoderV1, value : UInt) -> Unit

    EncoderV1::write_f32

    fn EncoderV1::write_f32(self : EncoderV1, value : Float) -> Unit

    EncoderV1::write_f64

    fn EncoderV1::write_f64(self : EncoderV1, value : Double) -> Unit

    EncoderV1::write_i64

    fn EncoderV1::write_i64(self : EncoderV1, value : Int64) -> Unit

    EncoderV1::write_info

    fn EncoderV1::write_info(self : EncoderV1, value : Byte) -> Unit

    EncoderV1::write_json

    fn EncoderV1::write_json(self : EncoderV1, value : Any) -> Unit

    EncoderV1::write_key

    fn EncoderV1::write_key(self : EncoderV1, value : String) -> Unit

    EncoderV1::write_left_id

    fn EncoderV1::write_left_id(self : EncoderV1, value : Id) -> Unit

    EncoderV1::write_len

    fn EncoderV1::write_len(self : EncoderV1, value : UInt) -> Unit

    EncoderV1::write_parent_info

    fn EncoderV1::write_parent_info(self : EncoderV1, value : Bool) -> Unit

    EncoderV1::write_right_id

    fn EncoderV1::write_right_id(self : EncoderV1, value : Id) -> Unit

    EncoderV1::write_string

    fn EncoderV1::write_string(self : EncoderV1, value : String) -> Unit

    EncoderV1::write_type_ref

    fn EncoderV1::write_type_ref(self : EncoderV1, value : Byte) -> Unit

    EncoderV1::write_u16

    fn EncoderV1::write_u16(self : EncoderV1, value : UInt16) -> Unit

    EncoderV1::write_u32

    fn EncoderV1::write_u32(self : EncoderV1, value : UInt) -> Unit

    EncoderV1::write_u32_be

    fn EncoderV1::write_u32_be(self : EncoderV1, value : UInt) -> Unit

    EncoderV1::write_u64

    fn EncoderV1::write_u64(self : EncoderV1, value : UInt64) -> Unit

    EncoderV1::write_u8

    fn EncoderV1::write_u8(self : EncoderV1, value : Byte) -> Unit

    EncoderV1::write_var_int

    fn EncoderV1::write_var_int(self : EncoderV1, value : Int64) -> Unit

    EncoderV1::write_var_signed

    fn EncoderV1::write_var_signed(self : EncoderV1, signed : (Int64, Bool)) -> Unit

    EncoderV1::write_var_uint

    fn EncoderV1::write_var_uint(self : EncoderV1, number : UInt64) -> Unit

    EncoderV2

    pub struct EncoderV2 {
    // private fields
    }

    lib0 v2 update encoder. to_bytes snapshots without consuming the encoder.
    impl Write for EncoderV2

    EncoderV2::EncoderV2

    fn EncoderV2::EncoderV2() -> EncoderV2

    EncoderV2::reset_ds_cur_val

    fn EncoderV2::reset_ds_cur_val(self : EncoderV2) -> Unit

    EncoderV2::to_bytes

    fn EncoderV2::to_bytes(self : EncoderV2) -> Bytes raise DecodeError

    EncoderV2::write_all

    fn EncoderV2::write_all(self : EncoderV2, bytes : Bytes) -> Unit

    EncoderV2::write_any

    fn EncoderV2::write_any(self : EncoderV2, value : Any) -> Unit

    EncoderV2::write_buf

    fn EncoderV2::write_buf(self : EncoderV2, bytes : Bytes) -> Unit

    EncoderV2::write_client

    fn EncoderV2::write_client(self : EncoderV2, value : UInt64) -> Unit

    EncoderV2::write_ds_clock

    fn EncoderV2::write_ds_clock(self : EncoderV2, value : UInt) -> Unit

    EncoderV2::write_ds_len

    fn EncoderV2::write_ds_len(self : EncoderV2, value : UInt) -> Unit

    EncoderV2::write_f32

    fn EncoderV2::write_f32(self : EncoderV2, value : Float) -> Unit

    EncoderV2::write_f64

    fn EncoderV2::write_f64(self : EncoderV2, value : Double) -> Unit

    EncoderV2::write_i64

    fn EncoderV2::write_i64(self : EncoderV2, value : Int64) -> Unit

    EncoderV2::write_info

    fn EncoderV2::write_info(self : EncoderV2, value : Byte) -> Unit

    EncoderV2::write_json

    fn EncoderV2::write_json(self : EncoderV2, value : Any) -> Unit

    EncoderV2::write_key

    fn EncoderV2::write_key(self : EncoderV2, value : String) -> Unit

    EncoderV2::write_left_id

    fn EncoderV2::write_left_id(self : EncoderV2, value : Id) -> Unit

    EncoderV2::write_len

    fn EncoderV2::write_len(self : EncoderV2, value : UInt) -> Unit

    EncoderV2::write_parent_info

    fn EncoderV2::write_parent_info(self : EncoderV2, value : Bool) -> Unit

    EncoderV2::write_right_id

    fn EncoderV2::write_right_id(self : EncoderV2, value : Id) -> Unit

    EncoderV2::write_string

    fn EncoderV2::write_string(self : EncoderV2, value : String) -> Unit

    EncoderV2::write_type_ref

    fn EncoderV2::write_type_ref(self : EncoderV2, value : Byte) -> Unit

    EncoderV2::write_u16

    fn EncoderV2::write_u16(self : EncoderV2, value : UInt16) -> Unit

    EncoderV2::write_u32

    fn EncoderV2::write_u32(self : EncoderV2, value : UInt) -> Unit

    EncoderV2::write_u32_be

    fn EncoderV2::write_u32_be(self : EncoderV2, value : UInt) -> Unit

    EncoderV2::write_u64

    fn EncoderV2::write_u64(self : EncoderV2, value : UInt64) -> Unit

    EncoderV2::write_u8

    fn EncoderV2::write_u8(self : EncoderV2, value : Byte) -> Unit

    EncoderV2::write_var_int

    fn EncoderV2::write_var_int(self : EncoderV2, value : Int64) -> Unit

    EncoderV2::write_var_signed

    fn EncoderV2::write_var_signed(self : EncoderV2, signed : (Int64, Bool)) -> Unit

    EncoderV2::write_var_uint

    fn EncoderV2::write_var_uint(self : EncoderV2, number : UInt64) -> Unit

    EntryChange

    pub(all) enum EntryChange {
    Inserted(Out)
    Updated(Out, Out)
    Removed(Out)
    }

    EntryChange::to_json

    fn EntryChange::to_json(self : EntryChange) -> Json

    Event

    pub(all) enum Event {
    Text(TextEvent)
    Array(ArrayEvent)
    Map(MapEvent)
    XmlFragment(XmlEvent)
    XmlText(XmlTextEvent)
    Weak(WeakEvent)
    }

    Event::path

    fn Event::path(self : Event) -> ReadOnlyArray[PathSegment]

    Event::target

    fn Event::target(self : Event) -> Out

    Hook

    pub struct Hook[S] {
    // private fields
    }

    S is a phantom type: only the logical identity is stored, never a live handle.
    impl Eq for Hook[S]
    impl Hash for Hook[S]
    impl Debug for Hook[S]

    Hook::Hook

    fn[S] Hook::Hook(id : BranchId) -> Hook[S]

    Hook::equal

    fn[S] Hook::equal(self : Hook[S], other : Hook[S]) -> Bool

    Hook::from_json

    fn[S] Hook::from_json(value : Json) -> Hook[S] raise DecodeError

    Hook::get

    fn[S : SharedRef] Hook::get(self : Hook[S], doc : Doc) -> S?

    Hook::hash

    fn[S] Hook::hash(self : Hook[S]) -> Int

    Hook::hash_combine

    fn[S] Hook::hash_combine(self : Hook[S], hasher : Hasher) -> Unit

    Hook::id

    fn[S] Hook::id(self : Hook[S]) -> BranchId

    Hook::into_nested

    fn[S] Hook::into_nested(self : Hook[S]) -> Nested[S]?

    Hook::into_root

    fn[S : RootRef + SharedRef] Hook::into_root(self : Hook[S]) -> Root[S]?

    Hook::not_equal

    fn[S] Hook::not_equal(x : Hook[S], y : Hook[S]) -> Bool

    Hook::to_json

    fn[S] Hook::to_json(self : Hook[S]) -> Json

    Hook::to_repr

    fn[S] Hook::to_repr(self : Hook[S]) ->
    Repr

    pub(all) struct Id {
    client : UInt64
    clock : UInt
    } derive(Compare, Eq, Hash,
    Debug
    )

    Id::compare

    fn Id::compare(Id, Id) -> Int

    Id::equal

    fn Id::equal(Id, Id) -> Bool

    Id::from_json

    fn Id::from_json(value : Json) -> Id raise DecodeError

    Id::hash

    fn Id::hash(self : Id) -> Int

    Id::hash_combine

    fn Id::hash_combine(Id, Hasher) -> Unit

    Id::not_equal

    fn Id::not_equal(x : Id, y : Id) -> Bool

    Id::op_ge

    fn Id::op_ge(x : Id, y : Id) -> Bool

    Id::op_gt

    fn Id::op_gt(x : Id, y : Id) -> Bool

    Id::op_le

    fn Id::op_le(x : Id, y : Id) -> Bool

    Id::op_lt

    fn Id::op_lt(x : Id, y : Id) -> Bool

    Id::to_json

    fn Id::to_json(self : Id) -> Json

    Id::to_repr

    IdMap

    pub struct IdMap[A] {
    // private fields
    }

    Metadata indexed by CRDT identity ranges. Overlaps union their attributes.
    impl Eq for IdMap[A]

    IdMap::IdMap

    fn[A] IdMap::IdMap() -> IdMap[A]

    IdMap::as_id_set

    fn[A] IdMap::as_id_set(self : IdMap[A]) -> IdSet

    IdMap::attributions

    fn[A] IdMap::attributions(self : IdMap[A], range : BlockRange) -> Array[AttrRange[A]]

    Covers the whole requested interval, including gaps with empty attributes.

    IdMap::contains

    fn[A] IdMap::contains(self : IdMap[A], id : Id) -> Bool

    IdMap::copy

    fn[A] IdMap::copy(self : IdMap[A]) -> IdMap[A]

    IdMap::decode_v1

    fn[A] IdMap::decode_v1(bytes : Bytes, decode_value : (Any) -> A raise DecodeError, max_items? : Int) -> IdMap[A] raise DecodeError

    IdMap::decode_v2

    fn[A] IdMap::decode_v2(bytes : Bytes, decode_value : (Any) -> A raise DecodeError, max_items? : Int) -> IdMap[A] raise DecodeError

    IdMap::diff_map_with

    fn[A : Eq, B] IdMap::diff_map_with(self : IdMap[A], other : IdMap[B]) -> Unit

    IdMap::diff_with

    fn[A : Eq] IdMap::diff_with(self : IdMap[A], other : IdSet) -> Unit

    IdMap::encode_v1

    fn[A : Eq] IdMap::encode_v1(self : IdMap[A], encode_value : (A) -> Any) -> Bytes

    IdMap::encode_v2

    fn[A : Eq] IdMap::encode_v2(self : IdMap[A], encode_value : (A) -> Any) -> Bytes raise DecodeError

    IdMap::equal

    fn[A : Eq] IdMap::equal(self : IdMap[A], other : IdMap[A]) -> Bool

    IdMap::filter

    fn[A] IdMap::filter(self : IdMap[A], predicate : (ReadOnlyArray[ContentAttribute[A]]) -> Bool) -> IdMap[A]

    IdMap::from_set

    fn[A : Eq] IdMap::from_set(set : IdSet, attrs : Array[ContentAttribute[A]]) -> IdMap[A]

    IdMap::insert

    fn[A : Eq] IdMap::insert(self : IdMap[A], range : BlockRange, attrs : Array[ContentAttribute[A]]) -> Unit

    IdMap::intersect_with

    fn[A : Eq] IdMap::intersect_with(self : IdMap[A], other : IdMap[A]) -> Unit

    Intersection retains shared identities and unions both maps' attributes.

    IdMap::is_empty

    fn[A] IdMap::is_empty(self : IdMap[A]) -> Bool

    IdMap::iter

    fn[A] IdMap::iter(self : IdMap[A]) -> Iter[(UInt64, AttrRange[A])]

    Snapshot iterator ordered by client ID, then clock.

    IdMap::merge_many

    fn[A : Eq] IdMap::merge_many(maps : Array[IdMap[A]]) -> IdMap[A]

    IdMap::merge_with

    fn[A : Eq] IdMap::merge_with(self : IdMap[A], other : IdMap[A]) -> Unit

    IdMap::not_equal

    fn[A : Eq] IdMap::not_equal(x : IdMap[A], y : IdMap[A]) -> Bool

    IdMap::remove

    fn[A : Eq] IdMap::remove(self : IdMap[A], range : BlockRange) -> Unit

    IdSet

    pub struct IdSet {
    // private fields
    }

    A normalized set of CRDT clock ranges. End clocks are exclusive. Like Yrs, zero-length insertion retains the client entry: length/is_empty count clients even when ranges() is empty. Difference/intersection prune them.
    impl Decode for IdSet
    impl Encode for IdSet

    IdSet::IdSet

    fn IdSet::IdSet(ranges? : Array[(UInt64, UInt, UInt)]) -> IdSet

    IdSet::client_ids

    fn IdSet::client_ids(self : IdSet) -> Array[UInt64]

    IdSet::contains

    fn IdSet::contains(self : IdSet, id : Id) -> Bool

    IdSet::decode

    fn IdSet::decode(decoder : &Decoder) -> IdSet raise DecodeError

    IdSet::decode_v1

    fn IdSet::decode_v1(bytes : Bytes) -> IdSet raise DecodeError

    IdSet::decode_v2

    fn IdSet::decode_v2(bytes : Bytes) -> IdSet raise DecodeError

    IdSet::diff

    fn IdSet::diff(self : IdSet, other : IdSet) -> IdSet

    IdSet::diff_with

    fn IdSet::diff_with(self : IdSet, other : IdSet) -> Unit

    IdSet::encode

    fn IdSet::encode(self : IdSet, encoder : &Encoder) -> Unit

    IdSet::encode_v1

    fn IdSet::encode_v1(self : IdSet) -> Bytes

    IdSet::encode_v2

    fn IdSet::encode_v2(self : IdSet) -> Bytes raise DecodeError

    IdSet::from_json

    fn IdSet::from_json(json : Json) -> IdSet raise DecodeError

    IdSet::get

    fn IdSet::get(self : IdSet, client : UInt64) -> Array[(UInt, UInt)]?

    IdSet::insert

    fn IdSet::insert(self : IdSet, id : Id, length : UInt) -> Unit

    IdSet::intersect

    fn IdSet::intersect(self : IdSet, other : IdSet) -> IdSet

    IdSet::intersect_with

    fn IdSet::intersect_with(self : IdSet, other : IdSet) -> Unit

    IdSet::is_empty

    fn IdSet::is_empty(self : IdSet) -> Bool

    IdSet::length

    fn IdSet::length(self : IdSet) -> Int

    Number of clients represented in this set, matching Yrs IdSet::len.

    IdSet::merge

    fn IdSet::merge(self : IdSet, other : IdSet) -> IdSet

    IdSet::merge_with

    fn IdSet::merge_with(self : IdSet, other : IdSet) -> Unit

    IdSet::ranges

    fn IdSet::ranges(self : IdSet) -> Array[(UInt64, UInt, UInt)]

    IdSet::remove_range

    fn IdSet::remove_range(self : IdSet, id : Id, length : UInt) -> Unit

    IdSet::to_json

    fn IdSet::to_json(self : IdSet) -> Json

    Rust serde represents IdSet as its v1 encoded byte array.
    pub(all) enum In {
    Value(Any)
    Array(ReadOnlyArray[In])
    Map(ReadOnlyArray[(String, In)])
    Text(ReadOnlyArray[DeltaOf[In]])
    XmlElement(String, ReadOnlyArray[(String, In)], ReadOnlyArray[In])
    XmlFragment(ReadOnlyArray[In])
    XmlText(ReadOnlyArray[DeltaOf[In]], ReadOnlyArray[(String, In)])
    Subdoc(Doc)
    WeakLink(WeakPrelim)
    }

    Detached input values. Shared collections are inserted as independent copies.

    IndexScope

    pub(all) enum IndexScope {
    Relative(Id)
    Nested(Id)
    Root(String)
    } derive(Eq,
    Debug
    )

    IndexScope::decode

    fn IndexScope::decode(decoder : &Decoder) -> IndexScope raise DecodeError

    IndexScope::decode_v1

    fn IndexScope::decode_v1(bytes : Bytes) -> IndexScope raise DecodeError

    IndexScope::decode_v2

    fn IndexScope::decode_v2(bytes : Bytes) -> IndexScope raise DecodeError

    IndexScope::encode

    fn IndexScope::encode(self : IndexScope, encoder : &Encoder) -> Unit

    IndexScope::encode_v1

    fn IndexScope::encode_v1(self : IndexScope) -> Bytes raise DecodeError

    IndexScope::encode_v2

    fn IndexScope::encode_v2(self : IndexScope) -> Bytes raise DecodeError

    IndexScope::equal

    fn IndexScope::equal(IndexScope, IndexScope) -> Bool

    IndexScope::not_equal

    fn IndexScope::not_equal(x : IndexScope, y : IndexScope) -> Bool

    JsonPath

    pub struct JsonPath {
    // private fields
    }

    The JSONPath subset supported by Yrs: members, indices, wildcards, recursive descent, slices and unions. Predicate expressions are not supported.

    JsonPath::parse

    fn JsonPath::parse(path : String) -> JsonPath raise JsonPathError

    LinkSource

    pub(all) struct LinkSource {
    start : StickyIndex
    end : StickyIndex
    } derive(Eq,
    Debug
    )

    A weak reference's two identity boundaries. Before includes a start identity and excludes an end identity; After excludes the start and includes the end.

    LinkSource::LinkSource

    fn LinkSource::LinkSource(start : StickyIndex, end : StickyIndex) -> LinkSource

    LinkSource::equal

    fn LinkSource::equal(LinkSource, LinkSource) -> Bool

    LinkSource::get_string

    fn LinkSource::get_string(self : LinkSource, doc : Doc) -> String

    LinkSource::is_single

    fn LinkSource::is_single(self : LinkSource) -> Bool

    LinkSource::not_equal

    fn LinkSource::not_equal(x : LinkSource, y : LinkSource) -> Bool

    LinkSource::to_delta

    fn LinkSource::to_delta(self : LinkSource, doc : Doc) -> Array[TextChunk]

    LinkSource::to_xml_string

    fn LinkSource::to_xml_string(self : LinkSource, doc : Doc) -> String

    LinkSource::try_deref_value

    fn LinkSource::try_deref_value(self : LinkSource, doc : Doc) -> Out?

    LinkSource::unquote

    fn LinkSource::unquote(self : LinkSource, doc : Doc) -> Array[Out]

    MapEvent

    pub struct MapEvent {
    // private fields
    }

    MapEvent::keys

    fn MapEvent::keys(self : MapEvent) -> Map[String, EntryChange]

    MapEvent::path

    fn MapEvent::path(self : MapEvent) -> ReadOnlyArray[PathSegment]

    MapEvent::target

    fn MapEvent::target(self : MapEvent) -> MapRef

    MapEvent::to_json

    fn MapEvent::to_json(self : MapEvent) -> Json

    MapRef

    pub struct MapRef {
    // private fields
    }

    impl AsPrelim for MapRef
    impl FromOut for MapRef
    impl RootRef for MapRef
    impl SharedRef for MapRef
    impl Eq for MapRef

    MapRef::clear

    fn MapRef::clear(self : MapRef) -> Unit

    MapRef::contains_key

    fn MapRef::contains_key(self : MapRef, key : String) -> Bool

    MapRef::default_prelim

    fn MapRef::default_prelim() -> In

    MapRef::entries

    fn MapRef::entries(self : MapRef) -> Array[(String, Out)]

    MapRef::equal

    fn MapRef::equal(self : MapRef, other : MapRef) -> Bool

    MapRef::from_branch

    fn MapRef::from_branch(doc : Doc, id : BranchId) -> MapRef?

    MapRef::from_out

    fn MapRef::from_out(value : Out) -> MapRef?

    MapRef::get

    fn MapRef::get(self : MapRef, key : String) -> Out?

    MapRef::get_as

    fn[T : FromAny] MapRef::get_as(self : MapRef, key : String) -> T raise ValueDecodeError

    Decode a collection value into an application type. Missing entries are null, matching upstream get_as. Implement FromAny for application records.

    MapRef::get_json_as

    Decode with MoonBit's JSON conventions instead (e.g. Int64 uses a string).

    MapRef::get_or_init

    fn[T : DefaultPrelim + SharedRef] MapRef::get_or_init(self : MapRef, key : String) -> T

    Return an existing value of the requested type, or replace a missing/wrongly typed entry with that type's empty preliminary value.

    MapRef::get_or_init_array

    fn MapRef::get_or_init_array(self : MapRef, key : String) -> ArrayRef

    MapRef::get_or_init_map

    fn MapRef::get_or_init_map(self : MapRef, key : String) -> MapRef

    MapRef::get_or_init_text

    fn MapRef::get_or_init_text(self : MapRef, key : String) -> Text

    MapRef::get_or_init_xml_fragment

    fn MapRef::get_or_init_xml_fragment(self : MapRef, key : String) -> XmlFragment

    MapRef::get_or_init_xml_text

    fn MapRef::get_or_init_xml_text(self : MapRef, key : String) -> XmlText

    MapRef::get_or_insert_root

    fn MapRef::get_or_insert_root(doc : Doc, name : String) -> MapRef

    MapRef::hook

    fn MapRef::hook(self : MapRef) -> Hook[MapRef]

    MapRef::insert

    fn MapRef::insert(self : MapRef, key : String, value : Any) -> Unit

    MapRef::insert_array

    fn MapRef::insert_array(self : MapRef, key : String) -> ArrayRef

    MapRef::insert_doc

    fn MapRef::insert_doc(self : MapRef, key : String, child : Doc) -> Doc

    MapRef::insert_input

    fn MapRef::insert_input(self : MapRef, key : String, input : In) -> Out

    MapRef::insert_map

    fn MapRef::insert_map(self : MapRef, key : String) -> MapRef

    MapRef::insert_text

    fn MapRef::insert_text(self : MapRef, key : String) -> Text

    MapRef::iter

    fn MapRef::iter(self : MapRef) -> Iter[(String, Out)]

    MapRef::keys

    fn MapRef::keys(self : MapRef) -> Iter[String]

    MapRef::length

    fn MapRef::length(self : MapRef) -> Int

    fn MapRef::link(self : MapRef, key : String) -> WeakPrelim?

    MapRef::not_equal

    fn MapRef::not_equal(x : MapRef, y : MapRef) -> Bool

    MapRef::observe

    fn MapRef::observe(self : MapRef, key : String, callback : (MapEvent, Transaction) -> Unit) -> Unit

    MapRef::observe_deep

    fn MapRef::observe_deep(self : MapRef, key : String, callback : (ReadOnlyArray[Event], Transaction) -> Unit) -> Unit

    MapRef::remove

    fn MapRef::remove(self : MapRef, key : String) -> Unit

    MapRef::remove_entry

    fn MapRef::remove_entry(self : MapRef, key : String) -> Out?

    Delete an entry and return its old handle. Shared contents are deleted too.

    MapRef::root

    fn MapRef::root(name : String) -> Root[MapRef]

    MapRef::to_input

    fn MapRef::to_input(self : MapRef) -> In

    MapRef::to_json

    fn MapRef::to_json(self : MapRef) -> Json

    MapRef::try_from_out

    fn MapRef::try_from_out(value : Out) -> Result[MapRef, Out]

    MapRef::try_update

    fn MapRef::try_update(self : MapRef, key : String, value : Any) -> Bool

    Avoid allocating a new operation when the existing primitive value is equal.

    MapRef::type_ref

    fn MapRef::type_ref() -> TypeRef

    MapRef::unobserve

    fn MapRef::unobserve(self : MapRef, key : String) -> Bool

    MapRef::unobserve_deep

    fn MapRef::unobserve_deep(self : MapRef, key : String) -> Bool

    MapRef::values

    fn MapRef::values(self : MapRef) -> Iter[Out]

    Message

    pub(all) enum Message {
    Sync(SyncMessage)
    Auth(String?)
    AwarenessQuery
    Awareness(AwarenessUpdate)
    Custom(Byte, Bytes)
    }

    Message::decode_v1

    fn Message::decode_v1(bytes : Bytes) -> Message raise DecodeError

    Message::encode_v1

    fn Message::encode_v1(self : Message) -> Bytes

    Nested

    pub struct Nested[S] {
    id : Id
    }

    impl Eq for Nested[S]
    impl Hash for Nested[S]
    impl Debug for Nested[S]

    Nested::Nested

    fn[S] Nested::Nested(id : Id) -> Nested[S]

    Nested::equal

    fn[S] Nested::equal(self : Nested[S], other : Nested[S]) -> Bool

    Nested::get

    fn[S : SharedRef] Nested::get(self : Nested[S], doc : Doc) -> S?

    Nested::hash

    fn[S] Nested::hash(self : Nested[S]) -> Int

    Nested::hash_combine

    fn[S] Nested::hash_combine(self : Nested[S], hasher : Hasher) -> Unit

    Nested::hook

    fn[S] Nested::hook(self : Nested[S]) -> Hook[S]

    Nested::not_equal

    fn[S] Nested::not_equal(x : Nested[S], y : Nested[S]) -> Bool

    Nested::to_repr

    fn[S] Nested::to_repr(self : Nested[S]) ->
    Repr

    Observer

    pub struct Observer[K, F] {
    // private fields
    }

    Named subscriptions. Keys may be strings, byte origins, or another hashable value. Dispatch order is unspecified. Removing a subscription takes effect immediately, including during an active dispatch. New subscriptions and replacements take effect on the next dispatch.

    Observer::Observer

    fn[K : Hash + Eq, F] Observer::Observer() -> Observer[K, F]

    Observer::has_subscribers

    fn[K, F] Observer::has_subscribers(self : Observer[K, F]) -> Bool

    Like Yrs, removed entries are drained after dispatch or before subscribing. This predicate can remain true between unsubscribe and the next drain.

    Observer::subscribe

    fn[K : Hash + Eq, F] Observer::subscribe(self : Observer[K, F], key : K, callback : F) -> Unit

    Observer::trigger

    fn[K : Hash + Eq, F] Observer::trigger(self : Observer[K, F], each : (F) -> Unit) -> Unit

    Observer::unsubscribe

    fn[K : Hash + Eq, F] Observer::unsubscribe(self : Observer[K, F], key : K) -> Bool

    Returns whether the key exists, including an entry awaiting removal.

    Offset

    pub(all) struct Offset {
    branch : BranchId
    index : Int
    assoc : Assoc
    } derive(Eq,
    Debug
    )

    Offset::equal

    fn Offset::equal(Offset, Offset) -> Bool

    Offset::not_equal

    fn Offset::not_equal(x : Offset, y : Offset) -> Bool

    Offset::to_repr

    OffsetKind

    pub(all) enum OffsetKind {
    Utf16
    Bytes
    } derive(Eq,
    Debug
    )

    User-facing text offsets. CRDT item clocks always count UTF-16 code units.

    OffsetKind::equal

    fn OffsetKind::equal(OffsetKind, OffsetKind) -> Bool

    OffsetKind::not_equal

    fn OffsetKind::not_equal(x : OffsetKind, y : OffsetKind) -> Bool

    Out

    pub(all) enum Out {
    Value(Any)
    Subdoc(Doc)
    UndefinedRef(UndefinedRef)
    Array(ArrayRef)
    Map(MapRef)
    Text(Text)
    XmlElement(XmlElement)
    XmlFragment(XmlFragment)
    XmlText(XmlText)
    WeakLink(WeakRef)
    } derive(Eq)

    A CRDT value is either an immutable lib0 value or a live shared-type handle.
    impl AsPrelim for Out

    Out::branch_id

    fn Out::branch_id(self : Out) -> BranchId?

    Stable collection identity; can be resolved on another replica of the document.

    Out::cast

    fn[T : FromOut] Out::cast(self : Out) -> Result[T, Out]

    Out::equal

    fn Out::equal(Out, Out) -> Bool

    Out::is_deleted

    fn Out::is_deleted(self : Out) -> Bool

    Out::not_equal

    fn Out::not_equal(x : Out, y : Out) -> Bool

    Out::to_any

    fn Out::to_any(self : Out) -> Any

    Read a JSON-like lib0 value without losing integer or binary representations.

    Out::to_input

    fn Out::to_input(self : Out) -> In

    Out::to_json

    fn Out::to_json(self : Out) -> Json

    Out::to_string

    fn Out::to_string(self : Out) -> String

    Out::type_ref

    fn Out::type_ref(self : Out) -> TypeRef?

    Primitive values have no shared-type descriptor.

    PathSegment

    pub(all) enum PathSegment {
    Key(String)
    Index(UInt)
    } derive(Eq,
    Debug
    )

    PathSegment::equal

    fn PathSegment::equal(PathSegment, PathSegment) -> Bool

    PathSegment::not_equal

    fn PathSegment::not_equal(x : PathSegment, y : PathSegment) -> Bool

    PathSegment::to_json

    fn PathSegment::to_json(self : PathSegment) -> Json

    QuoteBound

    pub(all) enum QuoteBound {
    Included(Int)
    Excluded(Int)
    Unbounded
    } derive(Eq,
    Debug
    )

    QuoteBound::equal

    fn QuoteBound::equal(QuoteBound, QuoteBound) -> Bool

    QuoteBound::not_equal

    fn QuoteBound::not_equal(x : QuoteBound, y : QuoteBound) -> Bool

    Root

    pub struct Root[S] {
    name : String
    }

    impl Eq for Root[S]
    impl Hash for Root[S]
    impl Debug for Root[S]

    Root::Root

    fn[S : RootRef + SharedRef] Root::Root(name : String) -> Root[S]

    Root::equal

    fn[S] Root::equal(self : Root[S], other : Root[S]) -> Bool

    Root::get

    fn[S : SharedRef] Root::get(self : Root[S], doc : Doc) -> S?

    Root::get_or_create

    fn[S : RootRef + SharedRef] Root::get_or_create(self : Root[S], doc : Doc) -> S

    Root::hash

    fn[S] Root::hash(self : Root[S]) -> Int

    Root::hash_combine

    fn[S] Root::hash_combine(self : Root[S], hasher : Hasher) -> Unit

    Root::hook

    fn[S] Root::hook(self : Root[S]) -> Hook[S]

    Root::not_equal

    fn[S] Root::not_equal(x : Root[S], y : Root[S]) -> Bool

    Root::to_repr

    fn[S] Root::to_repr(self : Root[S]) ->
    Repr

    Snapshot

    pub struct Snapshot {
    // private fields
    } derive(
    Debug
    )

    A logical document version: observed insert clocks and deletion ranges. The snapshot owns its metadata; later edits do not mutate it.
    impl Decode for Snapshot
    impl Encode for Snapshot
    impl Eq for Snapshot

    Snapshot::Snapshot

    fn Snapshot::Snapshot(state? : StateVector, deletions? : Array[(UInt64, UInt, UInt)], delete_set? : IdSet) -> Snapshot

    Deletion tuples contain client ID, inclusive start and exclusive end. Optional delete_set metadata is copied and unioned with these tuples.

    Snapshot::decode

    fn Snapshot::decode(decoder : &Decoder) -> Snapshot raise DecodeError

    Snapshot::decode_v1

    fn Snapshot::decode_v1(bytes : Bytes) -> Snapshot raise DecodeError

    Snapshot::decode_v2

    fn Snapshot::decode_v2(bytes : Bytes) -> Snapshot raise DecodeError

    Snapshot::delete_set

    fn Snapshot::delete_set(self : Snapshot) -> IdSet

    Return an owned copy, retaining clients with no deletion ranges.

    Snapshot::deletions

    fn Snapshot::deletions(self : Snapshot) -> Array[(UInt64, UInt, UInt)]

    Snapshot::encode

    fn Snapshot::encode(self : Snapshot, encoder : &Encoder) -> Unit

    Snapshot::encode_v1

    fn Snapshot::encode_v1(self : Snapshot) -> Bytes

    Snapshot::encode_v2

    fn Snapshot::encode_v2(self : Snapshot) -> Bytes raise DecodeError

    Snapshot::equal

    fn Snapshot::equal(self : Snapshot, other : Snapshot) -> Bool

    Snapshot::is_visible

    fn Snapshot::is_visible(self : Snapshot, id : Id) -> Bool

    Snapshot::not_equal

    fn Snapshot::not_equal(x : Snapshot, y : Snapshot) -> Bool

    Snapshot::state_vector

    fn Snapshot::state_vector(self : Snapshot) -> StateVector

    Snapshot::to_repr

    StackItem

    pub struct StackItem[M] {
    meta : M
    // private fields
    }

    StackItem::StackItem

    fn[M] StackItem::StackItem(doc : Doc, insertions? : IdSet, deletions? : IdSet, meta~ : M) -> StackItem[M]

    Reconstruct a stack item against a loaded document. Retain deleted content when persisting documents whose undo stacks will be restored later.

    StackItem::deletions

    fn[M] StackItem::deletions(self : StackItem[M]) -> Array[(UInt64, UInt, UInt)]

    StackItem::doc

    fn[M] StackItem::doc(self : StackItem[M]) -> Doc

    StackItem::from_json

    fn[M] StackItem::from_json(json : Json, doc : Doc, decode_meta : (Json) -> M raise DecodeError) -> StackItem[M] raise DecodeError

    StackItem::insertions

    fn[M] StackItem::insertions(self : StackItem[M]) -> Array[(UInt64, UInt, UInt)]

    StackItem::merge

    fn[M] StackItem::merge(self : StackItem[M], other : StackItem[M], merge_meta : (M, M) -> M) -> Unit

    StackItem::set_meta

    fn[M] StackItem::set_meta(self : StackItem[M], meta : M) -> Unit

    StackItem::to_json

    fn[M] StackItem::to_json(self : StackItem[M], encode_meta : (M) -> Json) -> Json

    Matches the Rust serde stack-item schema, with caller-defined metadata encoding.

    StateVector

    pub struct StateVector {
    // private fields
    } derive(
    Debug
    )

    Next expected clock for each client; clocks count UTF-16 units for text.
    impl Eq for StateVector

    StateVector::StateVector

    fn StateVector::StateVector(entries? : Array[(UInt64, UInt)]) -> StateVector

    StateVector::contains

    fn StateVector::contains(self : StateVector, id : Id) -> Bool

    Upstream containment includes the boundary clock. Use Snapshot::is_visible when testing whether a concrete item is visible in a document version.

    StateVector::contains_client

    fn StateVector::contains_client(self : StateVector, client : UInt64) -> Bool

    StateVector::decode

    fn StateVector::decode(decoder : &Decoder) -> StateVector raise DecodeError

    StateVector::decode_v1

    fn StateVector::decode_v1(bytes : Bytes) -> StateVector raise DecodeError

    StateVector::decode_v2

    fn StateVector::decode_v2(bytes : Bytes) -> StateVector raise DecodeError

    StateVector::encode

    fn StateVector::encode(self : StateVector, encoder : &Encoder) -> Unit

    StateVector::encode_v1

    fn StateVector::encode_v1(self : StateVector) -> Bytes

    StateVector::encode_v2

    fn StateVector::encode_v2(self : StateVector) -> Bytes raise DecodeError

    StateVector::entries

    fn StateVector::entries(self : StateVector) -> Array[(UInt64, UInt)]

    StateVector::equal

    fn StateVector::equal(self : StateVector, other : StateVector) -> Bool

    StateVector::get

    fn StateVector::get(self : StateVector, client : UInt64) -> UInt

    StateVector::inc_by

    fn StateVector::inc_by(self : StateVector, client : UInt64, delta : UInt) -> Unit

    StateVector::is_empty

    fn StateVector::is_empty(self : StateVector) -> Bool

    StateVector::iter

    fn StateVector::iter(self : StateVector) -> Iter[(UInt64, UInt)]

    StateVector::length

    fn StateVector::length(self : StateVector) -> Int

    StateVector::merge

    fn StateVector::merge(self : StateVector, other : StateVector) -> Unit

    StateVector::not_equal

    fn StateVector::not_equal(x : StateVector, y : StateVector) -> Bool

    StateVector::partial_compare

    fn StateVector::partial_compare(self : StateVector, other : StateVector) -> Int?

    Returns -1, 0 or 1 for ordered vectors, or None for concurrent versions.

    StateVector::set_max

    fn StateVector::set_max(self : StateVector, client : UInt64, clock : UInt) -> Unit

    StateVector::set_min

    fn StateVector::set_min(self : StateVector, client : UInt64, clock : UInt) -> Unit

    StickyIndex

    pub(all) struct StickyIndex {
    scope : IndexScope
    assoc : Assoc
    } derive(Eq,
    Debug
    )

    StickyIndex::StickyIndex

    fn StickyIndex::StickyIndex(scope~ : IndexScope, assoc? : Assoc) -> StickyIndex

    StickyIndex::decode

    fn StickyIndex::decode(decoder : &Decoder) -> StickyIndex raise DecodeError

    StickyIndex::decode_v1

    fn StickyIndex::decode_v1(bytes : Bytes) -> StickyIndex raise DecodeError

    StickyIndex::decode_v2

    fn StickyIndex::decode_v2(bytes : Bytes) -> StickyIndex raise DecodeError

    StickyIndex::encode

    fn StickyIndex::encode(self : StickyIndex, encoder : &Encoder) -> Unit

    StickyIndex::encode_v1

    fn StickyIndex::encode_v1(self : StickyIndex) -> Bytes

    StickyIndex::encode_v2

    fn StickyIndex::encode_v2(self : StickyIndex) -> Bytes raise DecodeError

    StickyIndex::equal

    fn StickyIndex::equal(StickyIndex, StickyIndex) -> Bool

    StickyIndex::from_json

    fn StickyIndex::from_json(value : Json) -> StickyIndex raise DecodeError

    StickyIndex::get_offset

    fn StickyIndex::get_offset(self : StickyIndex, doc : Doc) -> Offset?

    StickyIndex::id

    fn StickyIndex::id(self : StickyIndex) -> Id?

    StickyIndex::is_nested

    fn StickyIndex::is_nested(self : StickyIndex) -> Bool

    StickyIndex::is_relative

    fn StickyIndex::is_relative(self : StickyIndex) -> Bool

    StickyIndex::is_root

    fn StickyIndex::is_root(self : StickyIndex) -> Bool

    StickyIndex::not_equal

    fn StickyIndex::not_equal(x : StickyIndex, y : StickyIndex) -> Bool

    StickyIndex::to_json

    fn StickyIndex::to_json(self : StickyIndex) -> Json

    SubdocsEvent

    pub struct SubdocsEvent {
    // private fields
    }

    SubdocsEvent::added

    fn SubdocsEvent::added(self : SubdocsEvent) -> ReadOnlyArray[Doc]

    SubdocsEvent::loaded

    fn SubdocsEvent::loaded(self : SubdocsEvent) -> ReadOnlyArray[Doc]

    SubdocsEvent::removed

    fn SubdocsEvent::removed(self : SubdocsEvent) -> ReadOnlyArray[Doc]

    SyncMessage

    pub(all) enum SyncMessage {
    SyncStep1(StateVector)
    SyncStep2(Bytes)
    Update(Bytes)
    }

    Text

    pub struct Text {
    // private fields
    }

    impl AsPrelim for Text
    impl FromOut for Text
    impl RootRef for Text
    impl SharedRef for Text
    impl Eq for Text

    Text::apply_delta

    fn Text::apply_delta(self : Text, delta : Array[DeltaOf[In]]) -> Unit

    Text::default_prelim

    fn Text::default_prelim() -> In

    Text::diff

    fn[M] Text::diff(self : Text, compute_ychange : (YChange) -> M) -> Array[Diff[M]]

    Text::diff_range

    fn[M] Text::diff_range(self : Text, compute_ychange : (YChange) -> M, hi? : Snapshot, lo? : Snapshot) -> Array[Diff[M]]

    Rich-text content at a saved version, optionally annotated against an older version. Deleted content must still be retained to reconstruct old versions.

    Text::equal

    fn Text::equal(self : Text, other : Text) -> Bool

    Text::format

    fn Text::format(self : Text, index : Int, length : Int, attributes : Array[(String, Any)]) -> Unit

    Text::from_branch

    fn Text::from_branch(doc : Doc, id : BranchId) -> Text?

    Text::from_out

    fn Text::from_out(value : Out) -> Text?

    Text::get_or_insert_root

    fn Text::get_or_insert_root(doc : Doc, name : String) -> Text

    Text::get_string

    fn Text::get_string(self : Text) -> String

    Text::hook

    fn Text::hook(self : Text) -> Hook[Text]

    Text::insert

    fn Text::insert(self : Text, index : Int, value : String) -> Unit

    Text::insert_embed

    fn Text::insert_embed(self : Text, index : Int, value : Any, attributes? : Array[(String, Any)]) -> Unit

    Text::insert_embed_input

    fn Text::insert_embed_input(self : Text, index : Int, input : In, attributes? : Array[(String, Any)]) -> Out

    Insert a primitive or shared collection as one embedded text element. Omitted attributes inherit the surrounding formatting; an explicit array replaces it. The returned handle refers to the newly integrated collection.

    Text::insert_with_attributes

    fn Text::insert_with_attributes(self : Text, index : Int, value : String, attributes : Array[(String, Any)]) -> Unit

    Text::length

    fn Text::length(self : Text) -> Int

    Text::not_equal

    fn Text::not_equal(x : Text, y : Text) -> Bool

    Text::observe

    fn Text::observe(self : Text, key : String, callback : (TextEvent, Transaction) -> Unit) -> Unit

    Text::observe_deep

    fn Text::observe_deep(self : Text, key : String, callback : (ReadOnlyArray[Event], Transaction) -> Unit) -> Unit

    Text::push

    fn Text::push(self : Text, value : String) -> Unit

    Text::quote

    fn Text::quote(self : Text, start : QuoteBound, end : QuoteBound) -> WeakPrelim raise QuoteError

    Text::remove_range

    fn Text::remove_range(self : Text, index : Int, length : Int) -> Unit

    Text::root

    fn Text::root(name : String) -> Root[Text]

    Text::sticky_boundary

    fn Text::sticky_boundary(self : Text, assoc? : Assoc) -> StickyIndex

    Track the start or end of this shared sequence, including an empty sequence.

    Text::sticky_index

    fn Text::sticky_index(self : Text, index : Int, assoc? : Assoc) -> StickyIndex?

    Track a position using CRDT identity. After at the end returns None, matching Yrs; use a Root/Nested StickyIndex to explicitly track a type boundary.

    Text::to_delta

    fn Text::to_delta(self : Text) -> Array[TextChunk]

    Text::to_input

    fn Text::to_input(self : Text) -> In

    Text::try_from_out

    fn Text::try_from_out(value : Out) -> Result[Text, Out]

    Text::type_ref

    fn Text::type_ref() -> TypeRef

    Text::unobserve

    fn Text::unobserve(self : Text, key : String) -> Bool

    Text::unobserve_deep

    fn Text::unobserve_deep(self : Text, key : String) -> Bool

    TextChunk

    pub(all) struct TextChunk {
    insert : Out
    attributes : ReadOnlyArray[(String, Any)]
    }

    TextChunk::to_json

    fn TextChunk::to_json(self : TextChunk) -> Json

    TextEvent

    pub struct TextEvent {
    // private fields
    }

    TextEvent::delta

    fn TextEvent::delta(self : TextEvent) -> ReadOnlyArray[DeltaOf[Out]]

    TextEvent::path

    fn TextEvent::path(self : TextEvent) -> ReadOnlyArray[PathSegment]

    TextEvent::target

    fn TextEvent::target(self : TextEvent) -> Text

    Transaction

    pub struct Transaction {
    // private fields
    }

    A grouped mutation scope. Metadata and encoded updates become stable when the scope closes. Use Doc::transact to commit even when the action raises.

    Transaction::after_state

    fn Transaction::after_state(self : Transaction) -> StateVector

    Transaction::before_state

    fn Transaction::before_state(self : Transaction) -> StateVector

    Transaction::changed_parent_types

    fn Transaction::changed_parent_types(self : Transaction) -> ReadOnlyArray[Out]

    Collections changed by this transaction and their ancestors. Ancestors may occur more than once, matching the upstream event traversal.

    Transaction::cleanups

    fn Transaction::cleanups(self : Transaction) -> IdSet

    Transaction::delete_set

    fn Transaction::delete_set(self : Transaction) -> IdSet

    Transaction::deletions

    fn Transaction::deletions(self : Transaction) -> Array[(UInt64, UInt, UInt)]

    Transaction::doc

    fn Transaction::doc(self : Transaction) -> Doc

    Transaction::encode_update

    fn Transaction::encode_update(self : Transaction, encoder : &Encoder) -> Unit

    Write just this transaction's insertions and deletions through a field codec.

    Transaction::encode_update_v1

    fn Transaction::encode_update_v1(self : Transaction) -> Bytes

    Transaction::encode_update_v2

    fn Transaction::encode_update_v2(self : Transaction) -> Bytes raise DecodeError

    Transaction::gc

    fn Transaction::gc(self : Transaction, delete_set? : IdSet) -> Unit

    Collect deleted content not retained for undo, even when skip_gc is true. Historical snapshots cannot reconstruct content once it has been collected.

    Transaction::has_changes

    fn Transaction::has_changes(self : Transaction) -> Bool

    Transaction::insert_set

    fn Transaction::insert_set(self : Transaction) -> IdSet

    Transaction::insertions

    fn Transaction::insertions(self : Transaction) -> Array[(UInt64, UInt, UInt)]

    Transaction::is_local

    fn Transaction::is_local(self : Transaction) -> Bool

    Transaction::origin

    fn Transaction::origin(self : Transaction) -> Bytes?

    TypeRef

    pub(all) enum TypeRef {
    Array
    Map
    Text
    XmlElement(String)
    XmlFragment
    XmlHook
    XmlText
    WeakLink(LinkSource)
    SubDoc
    Undefined
    } derive(Eq,
    Debug
    )

    Shared-type metadata used by update codecs. XmlHook and Undefined preserve legacy/untyped descriptors even when no concrete collection handle exists.
    impl Decode for TypeRef
    impl Encode for TypeRef

    TypeRef::decode

    fn TypeRef::decode(decoder : &Decoder) -> TypeRef raise DecodeError

    TypeRef::decode_v1

    fn TypeRef::decode_v1(bytes : Bytes) -> TypeRef raise DecodeError

    TypeRef::decode_v2

    fn TypeRef::decode_v2(bytes : Bytes) -> TypeRef raise DecodeError

    TypeRef::encode

    fn TypeRef::encode(self : TypeRef, encoder : &Encoder) -> Unit

    TypeRef::encode_v1

    fn TypeRef::encode_v1(self : TypeRef) -> Bytes raise DecodeError

    TypeRef::encode_v2

    fn TypeRef::encode_v2(self : TypeRef) -> Bytes raise DecodeError

    TypeRef::equal

    fn TypeRef::equal(TypeRef, TypeRef) -> Bool

    TypeRef::kind

    fn TypeRef::kind(self : TypeRef) -> Byte

    TypeRef::not_equal

    fn TypeRef::not_equal(x : TypeRef, y : TypeRef) -> Bool

    TypeRef::to_repr

    UndefinedRef

    pub struct UndefinedRef {
    // private fields
    }

    Preserved compatibility branches for upstream XmlHook, SubDoc type-ref and Undefined type-ref values. Real subdocuments use content reference 9.
    impl Eq for UndefinedRef

    UndefinedRef::as_array

    fn UndefinedRef::as_array(self : UndefinedRef) -> ArrayRef

    UndefinedRef::as_map

    fn UndefinedRef::as_map(self : UndefinedRef) -> MapRef

    UndefinedRef::as_text

    fn UndefinedRef::as_text(self : UndefinedRef) -> Text

    UndefinedRef::equal

    fn UndefinedRef::equal(self : UndefinedRef, other : UndefinedRef) -> Bool

    UndefinedRef::not_equal

    fn UndefinedRef::not_equal(x : UndefinedRef, y : UndefinedRef) -> Bool

    UndefinedRef::to_input

    fn UndefinedRef::to_input(self : UndefinedRef) -> In

    UndefinedRef::type_ref

    fn UndefinedRef::type_ref(self : UndefinedRef) -> Int

    UndoEvent

    pub struct UndoEvent[M] {
    meta : M
    // private fields
    }

    UndoEvent::changed_parent_types

    fn[M] UndoEvent::changed_parent_types(self : UndoEvent[M]) -> ReadOnlyArray[Out]

    UndoEvent::has_changed

    fn[M] UndoEvent::has_changed(self : UndoEvent[M], target : Out) -> Bool

    UndoEvent::kind

    fn[M] UndoEvent::kind(self : UndoEvent[M]) -> UndoEventKind

    UndoEvent::origin

    fn[M] UndoEvent::origin(self : UndoEvent[M]) -> Bytes?

    UndoEvent::set_meta

    fn[M] UndoEvent::set_meta(self : UndoEvent[M], meta : M) -> Unit

    UndoEventKind

    pub(all) enum UndoEventKind {
    Undo
    Redo
    } derive(Eq,
    Debug
    )

    UndoEventKind::equal

    UndoEventKind::not_equal

    fn UndoEventKind::not_equal(x : UndoEventKind, y : UndoEventKind) -> Bool

    UndoManager

    pub struct UndoManager[M] {
    // private fields
    }

    UndoManager::UndoManager

    fn[M : Default] UndoManager::UndoManager(clock~ : () -> UInt64, capture_timeout_millis? : UInt64, tracked_origins? : Array[Bytes], capture_transaction? : (Transaction) -> Bool, init_undo_stack? : Array[StackItem[M]], init_redo_stack? : Array[StackItem[M]]) -> UndoManager[M]

    A selective CRDT undo manager. The host supplies a millisecond clock. Capture applies only to scoped collections and the configured origins.

    UndoManager::as_origin

    fn[M] UndoManager::as_origin(self : UndoManager[M]) -> Bytes

    UndoManager::can_redo

    fn[M] UndoManager::can_redo(self : UndoManager[M]) -> Bool

    UndoManager::can_undo

    fn[M] UndoManager::can_undo(self : UndoManager[M]) -> Bool

    UndoManager::clear_all

    fn[M] UndoManager::clear_all(self : UndoManager[M]) -> Unit

    UndoManager::clear_redo

    fn[M] UndoManager::clear_redo(self : UndoManager[M]) -> Unit

    UndoManager::clear_undo

    fn[M] UndoManager::clear_undo(self : UndoManager[M]) -> Unit

    UndoManager::destroy

    fn[M] UndoManager::destroy(self : UndoManager[M]) -> Unit

    UndoManager::docs

    fn[M] UndoManager::docs(self : UndoManager[M]) -> Array[Doc]

    UndoManager::exclude_origin

    fn[M] UndoManager::exclude_origin(self : UndoManager[M], origin : Bytes) -> Unit

    UndoManager::expand_scope

    fn[M] UndoManager::expand_scope(self : UndoManager[M], target : Out) -> Unit

    UndoManager::include_origin

    fn[M] UndoManager::include_origin(self : UndoManager[M], origin : Bytes) -> Unit

    UndoManager::observe_item_added

    fn[M] UndoManager::observe_item_added(self : UndoManager[M], key : String, callback : (UndoEvent[M], Transaction) -> Unit) -> Unit

    UndoManager::observe_item_popped

    fn[M] UndoManager::observe_item_popped(self : UndoManager[M], key : String, callback : (UndoEvent[M], Transaction) -> Unit) -> Unit

    UndoManager::observe_item_updated

    fn[M] UndoManager::observe_item_updated(self : UndoManager[M], key : String, callback : (UndoEvent[M], Transaction) -> Unit) -> Unit

    UndoManager::observe_stack_cleared

    fn[M] UndoManager::observe_stack_cleared(self : UndoManager[M], key : String, callback : (Bool, Bool) -> Unit) -> Unit

    UndoManager::redo

    fn[M] UndoManager::redo(self : UndoManager[M]) -> Bool

    UndoManager::redo_stack

    fn[M] UndoManager::redo_stack(self : UndoManager[M]) -> ReadOnlyArray[StackItem[M]]

    UndoManager::reset

    fn[M] UndoManager::reset(self : UndoManager[M]) -> Unit

    UndoManager::undo

    fn[M] UndoManager::undo(self : UndoManager[M]) -> Bool

    UndoManager::undo_stack

    fn[M] UndoManager::undo_stack(self : UndoManager[M]) -> ReadOnlyArray[StackItem[M]]

    UndoManager::unobserve_item_added

    fn[M] UndoManager::unobserve_item_added(self : UndoManager[M], key : String) -> Bool

    UndoManager::unobserve_item_popped

    fn[M] UndoManager::unobserve_item_popped(self : UndoManager[M], key : String) -> Bool

    UndoManager::unobserve_item_updated

    fn[M] UndoManager::unobserve_item_updated(self : UndoManager[M], key : String) -> Bool

    UndoManager::unobserve_stack_cleared

    fn[M] UndoManager::unobserve_stack_cleared(self : UndoManager[M], key : String) -> Bool

    Update

    pub struct Update {
    // private fields
    }

    A decoded, unintegrated update. Inspect or merge it without creating a replica.
    impl Decode for Update
    impl Encode for Update

    Update::Update

    fn Update::Update() -> Update

    Update::decode

    fn Update::decode(decoder : &Decoder) -> Update raise DecodeError

    Update::decode_v1

    fn Update::decode_v1(bytes : Bytes) -> Update raise DecodeError

    Update::decode_v2

    fn Update::decode_v2(bytes : Bytes, max_items? : Int) -> Update raise DecodeError

    Update::delete_set

    fn Update::delete_set(self : Update) -> IdSet

    Update::encode

    fn Update::encode(self : Update, encoder : &Encoder) -> Unit

    Update::encode_diff_v1

    fn Update::encode_diff_v1(self : Update, state : StateVector) -> Bytes

    Update::encode_diff_v2

    fn Update::encode_diff_v2(self : Update, state : StateVector) -> Bytes raise DecodeError

    Update::encode_v1

    fn Update::encode_v1(self : Update) -> Bytes

    Update::encode_v2

    fn Update::encode_v2(self : Update) -> Bytes raise DecodeError

    Update::extends

    fn Update::extends(self : Update, state : StateVector) -> Bool

    Whether a non-skip block covers the next expected clock for any client. Deletions alone do not extend a state vector.

    Update::insertions

    fn Update::insertions(self : Update, include_deleted? : Bool) -> IdSet

    The wire delete set has not been integrated: encoded item blocks (including ContentDeleted) are included; include_deleted also includes GC blocks.

    Update::is_empty

    fn Update::is_empty(self : Update) -> Bool

    Update::merge

    fn Update::merge(self : Update, other : Update) -> Unit

    Update::state_vector

    fn Update::state_vector(self : Update) -> StateVector

    Update::state_vector_lower

    fn Update::state_vector_lower(self : Update) -> StateVector

    WeakEvent

    pub struct WeakEvent {
    // private fields
    }

    WeakEvent::path

    fn WeakEvent::path(self : WeakEvent) -> ReadOnlyArray[PathSegment]

    WeakEvent::target

    fn WeakEvent::target(self : WeakEvent) -> WeakRef

    WeakPrelim

    pub struct WeakPrelim {
    // private fields
    }

    WeakPrelim::WeakPrelim

    fn WeakPrelim::WeakPrelim(source : LinkSource) -> WeakPrelim

    WeakPrelim::get_string

    fn WeakPrelim::get_string(self : WeakPrelim, doc : Doc) -> String

    WeakPrelim::source

    fn WeakPrelim::source(self : WeakPrelim) -> LinkSource

    WeakPrelim::try_deref

    fn[T : FromOut] WeakPrelim::try_deref(self : WeakPrelim, doc : Doc) -> Result[T, Out?]

    WeakPrelim::try_deref_value

    fn WeakPrelim::try_deref_value(self : WeakPrelim, doc : Doc) -> Out?

    WeakPrelim::unquote

    fn WeakPrelim::unquote(self : WeakPrelim, doc : Doc) -> Array[Out]

    WeakRef

    pub struct WeakRef {
    // private fields
    }

    impl AsPrelim for WeakRef
    impl FromOut for WeakRef
    impl Eq for WeakRef

    WeakRef::as_prelim

    fn WeakRef::as_prelim(self : WeakRef) -> WeakPrelim

    WeakRef::branch_id

    fn WeakRef::branch_id(self : WeakRef) -> BranchId

    WeakRef::end_id

    fn WeakRef::end_id(self : WeakRef) -> Id?

    WeakRef::equal

    fn WeakRef::equal(self : WeakRef, other : WeakRef) -> Bool

    WeakRef::from_branch

    fn WeakRef::from_branch(doc : Doc, id : BranchId) -> WeakRef?

    WeakRef::get_string

    fn WeakRef::get_string(self : WeakRef) -> String

    WeakRef::get_xml_string

    fn WeakRef::get_xml_string(self : WeakRef) -> String

    WeakRef::hook

    fn WeakRef::hook(self : WeakRef) -> Hook[WeakRef]

    WeakRef::is_deleted

    fn WeakRef::is_deleted(self : WeakRef) -> Bool

    WeakRef::not_equal

    fn WeakRef::not_equal(x : WeakRef, y : WeakRef) -> Bool

    WeakRef::observe

    fn WeakRef::observe(self : WeakRef, key : String, callback : (WeakEvent, Transaction) -> Unit) -> Unit

    WeakRef::observe_deep

    fn WeakRef::observe_deep(self : WeakRef, key : String, callback : (ReadOnlyArray[Event], Transaction) -> Unit) -> Unit

    WeakRef::source

    fn WeakRef::source(self : WeakRef) -> LinkSource

    WeakRef::start_id

    fn WeakRef::start_id(self : WeakRef) -> Id?

    WeakRef::to_delta

    fn WeakRef::to_delta(self : WeakRef) -> Array[TextChunk]

    WeakRef::to_input

    fn WeakRef::to_input(self : WeakRef) -> In

    WeakRef::try_deref

    fn[T : FromOut] WeakRef::try_deref(self : WeakRef) -> Result[T, Out?]

    Resolve a map link, distinguishing a missing entry from a rejected value.

    WeakRef::try_deref_value

    fn WeakRef::try_deref_value(self : WeakRef) -> Out?

    WeakRef::try_from_out

    fn WeakRef::try_from_out(value : Out) -> Result[WeakRef, Out]

    WeakRef::unobserve

    fn WeakRef::unobserve(self : WeakRef, key : String) -> Bool

    WeakRef::unobserve_deep

    fn WeakRef::unobserve_deep(self : WeakRef, key : String) -> Bool

    WeakRef::unquote

    fn WeakRef::unquote(self : WeakRef) -> Array[Out]

    XmlElement

    pub struct XmlElement {
    // private fields
    }

    impl Eq for XmlElement

    XmlElement::as_fragment

    fn XmlElement::as_fragment(self : XmlElement) -> XmlFragment

    XmlElement::as_map

    fn XmlElement::as_map(self : XmlElement) -> MapRef

    XmlElement::attributes

    fn XmlElement::attributes(self : XmlElement) -> Array[(String, Out)]

    XmlElement::equal

    fn XmlElement::equal(self : XmlElement, other : XmlElement) -> Bool

    XmlElement::from_branch

    fn XmlElement::from_branch(doc : Doc, id : BranchId) -> XmlElement?

    XmlElement::get_attribute

    fn XmlElement::get_attribute(self : XmlElement, key : String) -> Out?

    XmlElement::get_string

    fn XmlElement::get_string(self : XmlElement) -> String

    Match upstream serialization: content and attribute values are not escaped.

    XmlElement::hook

    fn XmlElement::hook(self : XmlElement) -> Hook[XmlElement]

    XmlElement::insert_attribute

    fn XmlElement::insert_attribute(self : XmlElement, key : String, value : Any) -> Unit

    XmlElement::not_equal

    fn XmlElement::not_equal(x : XmlElement, y : XmlElement) -> Bool

    XmlElement::observe

    fn XmlElement::observe(self : XmlElement, key : String, callback : (XmlEvent, Transaction) -> Unit) -> Unit

    XmlElement::observe_deep

    fn XmlElement::observe_deep(self : XmlElement, key : String, callback : (ReadOnlyArray[Event], Transaction) -> Unit) -> Unit

    XmlElement::parent

    fn XmlElement::parent(self : XmlElement) -> XmlNode?

    XmlElement::quote

    fn XmlElement::quote(self : XmlElement, start : QuoteBound, end : QuoteBound) -> WeakPrelim raise QuoteError

    XmlElement::remove_attribute

    fn XmlElement::remove_attribute(self : XmlElement, key : String) -> Unit

    XmlElement::sticky_boundary

    fn XmlElement::sticky_boundary(self : XmlElement, assoc? : Assoc) -> StickyIndex

    Track the start or end of this shared sequence, including an empty sequence.

    XmlElement::sticky_index

    fn XmlElement::sticky_index(self : XmlElement, index : Int, assoc? : Assoc) -> StickyIndex?

    Track a position using CRDT identity. After at the end returns None, matching Yrs; use a Root/Nested StickyIndex to explicitly track a type boundary.

    XmlElement::tag

    fn XmlElement::tag(self : XmlElement) -> String

    XmlElement::to_input

    fn XmlElement::to_input(self : XmlElement) -> In

    XmlElement::try_from_out

    fn XmlElement::try_from_out(value : Out) -> Result[XmlElement, Out]

    XmlElement::unobserve

    fn XmlElement::unobserve(self : XmlElement, key : String) -> Bool

    XmlElement::unobserve_deep

    fn XmlElement::unobserve_deep(self : XmlElement, key : String) -> Bool

    XmlEvent

    pub struct XmlEvent {
    // private fields
    }

    XmlEvent::added

    fn XmlEvent::added(self : XmlEvent) -> ReadOnlyArray[Id]

    Inserted child block identities, excluding children also removed in this transaction.

    XmlEvent::children_changed

    fn XmlEvent::children_changed(self : XmlEvent) -> Bool

    XmlEvent::deleted

    fn XmlEvent::deleted(self : XmlEvent) -> ReadOnlyArray[Id]

    Removed child block identities, excluding transient new children.

    XmlEvent::delta

    fn XmlEvent::delta(self : XmlEvent) -> ReadOnlyArray[Change]

    XmlEvent::keys

    fn XmlEvent::keys(self : XmlEvent) -> Map[String, EntryChange]

    XmlEvent::path

    fn XmlEvent::path(self : XmlEvent) -> ReadOnlyArray[PathSegment]

    XmlEvent::target

    fn XmlEvent::target(self : XmlEvent) -> XmlNode

    XmlFragment

    pub struct XmlFragment {
    // private fields
    }

    impl Eq for XmlFragment

    XmlFragment::as_map

    fn XmlFragment::as_map(self : XmlFragment) -> MapRef

    XmlFragment::attributes

    fn XmlFragment::attributes(self : XmlFragment) -> Array[(String, Out)]

    XmlFragment::children

    fn XmlFragment::children(self : XmlFragment) -> Array[XmlNode]

    XmlFragment::default_prelim

    fn XmlFragment::default_prelim() -> In

    XmlFragment::equal

    fn XmlFragment::equal(self : XmlFragment, other : XmlFragment) -> Bool

    XmlFragment::first_child

    fn XmlFragment::first_child(self : XmlFragment) -> XmlNode?

    XmlFragment::from_branch

    fn XmlFragment::from_branch(doc : Doc, id : BranchId) -> XmlFragment?

    XmlFragment::from_out

    fn XmlFragment::from_out(value : Out) -> XmlFragment?

    XmlFragment::get

    fn XmlFragment::get(self : XmlFragment, index : Int) -> XmlNode?

    XmlFragment::get_attribute

    fn XmlFragment::get_attribute(self : XmlFragment, key : String) -> Out?

    XmlFragment::get_or_insert_root

    fn XmlFragment::get_or_insert_root(doc : Doc, name : String) -> XmlFragment

    XmlFragment::get_string

    fn XmlFragment::get_string(self : XmlFragment) -> String

    XmlFragment::hook

    XmlFragment::insert

    fn XmlFragment::insert(self : XmlFragment, index : Int, value : In) -> XmlNode

    XmlFragment::insert_attribute

    fn XmlFragment::insert_attribute(self : XmlFragment, key : String, value : Any) -> Unit

    XmlFragment::insert_element

    fn XmlFragment::insert_element(self : XmlFragment, index : Int, tag : String) -> XmlElement

    XmlFragment::insert_fragment

    fn XmlFragment::insert_fragment(self : XmlFragment, index : Int) -> XmlFragment

    XmlFragment::insert_text

    fn XmlFragment::insert_text(self : XmlFragment, index : Int) -> XmlText

    XmlFragment::length

    fn XmlFragment::length(self : XmlFragment) -> Int

    XmlFragment::not_equal

    fn XmlFragment::not_equal(x : XmlFragment, y : XmlFragment) -> Bool

    XmlFragment::observe

    fn XmlFragment::observe(self : XmlFragment, key : String, callback : (XmlEvent, Transaction) -> Unit) -> Unit

    XmlFragment::observe_deep

    fn XmlFragment::observe_deep(self : XmlFragment, key : String, callback : (ReadOnlyArray[Event], Transaction) -> Unit) -> Unit

    XmlFragment::parent

    fn XmlFragment::parent(self : XmlFragment) -> XmlNode?

    XmlFragment::push_back

    fn XmlFragment::push_back(self : XmlFragment, value : In) -> XmlNode

    XmlFragment::push_front

    fn XmlFragment::push_front(self : XmlFragment, value : In) -> XmlNode

    XmlFragment::quote

    fn XmlFragment::quote(self : XmlFragment, start : QuoteBound, end : QuoteBound) -> WeakPrelim raise QuoteError

    XmlFragment::remove

    fn XmlFragment::remove(self : XmlFragment, index : Int) -> Unit

    XmlFragment::remove_attribute

    fn XmlFragment::remove_attribute(self : XmlFragment, key : String) -> Unit

    XmlFragment::remove_range

    fn XmlFragment::remove_range(self : XmlFragment, index : Int, length : Int) -> Unit

    XmlFragment::root

    fn XmlFragment::root(name : String) -> Root[XmlFragment]

    XmlFragment::sticky_boundary

    fn XmlFragment::sticky_boundary(self : XmlFragment, assoc? : Assoc) -> StickyIndex

    Track the start or end of this shared sequence, including an empty sequence.

    XmlFragment::sticky_index

    fn XmlFragment::sticky_index(self : XmlFragment, index : Int, assoc? : Assoc) -> StickyIndex?

    Track a position using CRDT identity. After at the end returns None, matching Yrs; use a Root/Nested StickyIndex to explicitly track a type boundary.

    XmlFragment::successors

    fn XmlFragment::successors(self : XmlFragment) -> Iter[XmlNode]

    Depth-first traversal, excluding this fragment and deleted subtrees.

    XmlFragment::to_input

    fn XmlFragment::to_input(self : XmlFragment) -> In

    XmlFragment::try_from_out

    fn XmlFragment::try_from_out(value : Out) -> Result[XmlFragment, Out]

    XmlFragment::type_ref

    fn XmlFragment::type_ref() -> TypeRef

    XmlFragment::unobserve

    fn XmlFragment::unobserve(self : XmlFragment, key : String) -> Bool

    XmlFragment::unobserve_deep

    fn XmlFragment::unobserve_deep(self : XmlFragment, key : String) -> Bool

    XmlNode

    pub(all) enum XmlNode {
    Element(XmlElement)
    Fragment(XmlFragment)
    Text(XmlText)
    } derive(Eq)

    impl AsPrelim for XmlNode
    impl FromOut for XmlNode

    XmlNode::as_out

    fn XmlNode::as_out(self : XmlNode) -> Out

    XmlNode::branch_id

    fn XmlNode::branch_id(self : XmlNode) -> BranchId

    XmlNode::equal

    fn XmlNode::equal(XmlNode, XmlNode) -> Bool

    XmlNode::get_string

    fn XmlNode::get_string(self : XmlNode) -> String

    XmlNode::is_deleted

    fn XmlNode::is_deleted(self : XmlNode) -> Bool

    XmlNode::next_sibling

    fn XmlNode::next_sibling(self : XmlNode) -> XmlNode?

    XmlNode::not_equal

    fn XmlNode::not_equal(x : XmlNode, y : XmlNode) -> Bool

    XmlNode::parent

    fn XmlNode::parent(self : XmlNode) -> XmlNode?

    XmlNode::prev_sibling

    fn XmlNode::prev_sibling(self : XmlNode) -> XmlNode?

    XmlNode::siblings

    fn XmlNode::siblings(self : XmlNode, backwards? : Bool) -> Iter[XmlNode]

    Following siblings; backwards=true visits preceding siblings nearest first.

    XmlNode::to_input

    fn XmlNode::to_input(self : XmlNode) -> In

    XmlNode::try_from_out

    fn XmlNode::try_from_out(value : Out) -> Result[XmlNode, Out]

    XmlText

    pub struct XmlText {
    // private fields
    }

    impl AsPrelim for XmlText
    impl FromOut for XmlText
    impl Eq for XmlText

    XmlText::as_map

    fn XmlText::as_map(self : XmlText) -> MapRef

    XmlText::as_text

    fn XmlText::as_text(self : XmlText) -> Text

    XmlText::attributes

    fn XmlText::attributes(self : XmlText) -> Array[(String, Out)]

    XmlText::default_prelim

    fn XmlText::default_prelim() -> In

    XmlText::diff

    fn[M] XmlText::diff(self : XmlText, compute_ychange : (YChange) -> M) -> Array[Diff[M]]

    XmlText::diff_range

    fn[M] XmlText::diff_range(self : XmlText, compute_ychange : (YChange) -> M, hi? : Snapshot, lo? : Snapshot) -> Array[Diff[M]]

    XmlText::equal

    fn XmlText::equal(self : XmlText, other : XmlText) -> Bool

    XmlText::from_branch

    fn XmlText::from_branch(doc : Doc, id : BranchId) -> XmlText?

    XmlText::from_out

    fn XmlText::from_out(value : Out) -> XmlText?

    XmlText::get_attribute

    fn XmlText::get_attribute(self : XmlText, key : String) -> Out?

    XmlText::get_string

    fn XmlText::get_string(self : XmlText) -> String

    XmlText::hook

    fn XmlText::hook(self : XmlText) -> Hook[XmlText]

    XmlText::insert_attribute

    fn XmlText::insert_attribute(self : XmlText, key : String, value : Any) -> Unit

    XmlText::not_equal

    fn XmlText::not_equal(x : XmlText, y : XmlText) -> Bool

    XmlText::observe

    fn XmlText::observe(self : XmlText, key : String, callback : (XmlTextEvent, Transaction) -> Unit) -> Unit

    XmlText::observe_deep

    fn XmlText::observe_deep(self : XmlText, key : String, callback : (ReadOnlyArray[Event], Transaction) -> Unit) -> Unit

    XmlText::parent

    fn XmlText::parent(self : XmlText) -> XmlNode?

    XmlText::quote

    fn XmlText::quote(self : XmlText, start : QuoteBound, end : QuoteBound) -> WeakPrelim raise QuoteError

    XmlText::remove_attribute

    fn XmlText::remove_attribute(self : XmlText, key : String) -> Unit

    XmlText::sticky_boundary

    fn XmlText::sticky_boundary(self : XmlText, assoc? : Assoc) -> StickyIndex

    Track the start or end of this shared sequence, including an empty sequence.

    XmlText::sticky_index

    fn XmlText::sticky_index(self : XmlText, index : Int, assoc? : Assoc) -> StickyIndex?

    Track a position using CRDT identity. After at the end returns None, matching Yrs; use a Root/Nested StickyIndex to explicitly track a type boundary.

    XmlText::to_input

    fn XmlText::to_input(self : XmlText) -> In

    XmlText::try_from_out

    fn XmlText::try_from_out(value : Out) -> Result[XmlText, Out]

    XmlText::unobserve

    fn XmlText::unobserve(self : XmlText, key : String) -> Bool

    XmlText::unobserve_deep

    fn XmlText::unobserve_deep(self : XmlText, key : String) -> Bool

    XmlTextEvent

    pub struct XmlTextEvent {
    // private fields
    }

    XmlTextEvent::delta

    fn XmlTextEvent::delta(self : XmlTextEvent) -> ReadOnlyArray[DeltaOf[Out]]

    XmlTextEvent::keys

    fn XmlTextEvent::keys(self : XmlTextEvent) -> Map[String, EntryChange]

    XmlTextEvent::path

    fn XmlTextEvent::path(self : XmlTextEvent) -> ReadOnlyArray[PathSegment]

    XmlTextEvent::target

    fn XmlTextEvent::target(self : XmlTextEvent) -> XmlText

    YChange

    pub(all) struct YChange {
    kind : ChangeKind
    id : Id
    } derive(Eq,
    Debug
    )

    YChange::equal

    fn YChange::equal(YChange, YChange) -> Bool

    YChange::identity

    fn YChange::identity(self : YChange) -> YChange

    YChange::not_equal

    fn YChange::not_equal(x : YChange, y : YChange) -> Bool

    YChange::to_repr

    convert_update_v1_to_v2

    fn convert_update_v1_to_v2(bytes : Bytes, max_items? : Int) -> Bytes raise DecodeError

    convert_update_v2_to_v1

    fn convert_update_v2_to_v1(bytes : Bytes, max_items? : Int) -> Bytes raise DecodeError

    Convert update wire formats without integrating a document. The budget bounds expanded blocks, values, client groups and delete ranges in compressed input.

    decode_messages

    fn decode_messages(bytes : Bytes) -> Array[Message] raise DecodeError

    diff_updates_v1

    fn diff_updates_v1(update : Bytes, state_vector : Bytes) -> Bytes raise DecodeError

    diff_updates_v2

    fn diff_updates_v2(update : Bytes, state_vector : Bytes) -> Bytes raise DecodeError

    encode_messages

    fn encode_messages(messages : Array[Message]) -> Bytes

    encode_state_vector_from_update_v1

    fn encode_state_vector_from_update_v1(update : Bytes) -> Bytes raise DecodeError

    Extract contiguous clock prefixes; a missing prefix or a skip is not known.

    encode_state_vector_from_update_v2

    fn encode_state_vector_from_update_v2(update : Bytes) -> Bytes raise DecodeError

    from_any

    fn[T : FromAny] from_any(value : Any) -> T raise ValueDecodeError

    merge_updates_v1

    fn merge_updates_v1(updates : Array[Bytes]) -> Bytes raise DecodeError

    Merge updates without integrating a document, preserving missing histories. Byte layout may differ from upstream block compaction; item identities and delete ranges are preserved. Unsupported content is rejected during decode.

    merge_updates_v2

    fn merge_updates_v2(updates : Array[Bytes]) -> Bytes raise DecodeError

    to_any

    fn[T : ToAny] to_any(value : T) -> Any raise ValueEncodeError

    uuid_v4

    fn uuid_v4(entropy : () -> Bytes) -> String

    Obtain a version-4 UUID using 16 fresh bytes from the host's entropy source. The callback is called once. Entropy is injected so every backend has the same API without silently falling back to a deterministic pseudo-random seed.

    uuid_v4_from

    fn uuid_v4_from(value : Bytes) -> String

    Format 16 bytes in network byte order as a lowercase version-4 UUID. The version and variant bits are set as in Yrs uuid_v4_from(u128). Requires exactly 16 bytes; the input is not modified.