piece

fun <S : Quilted<S>> S.piece(patch: Patch<S>): S

Absorb a patch into this state via Quilted.piece.


inline fun <S : Quilted<S>> S.piece(mutate: (S) -> Patch<S>): S

This state with the delta mutate produces from it absorbed — the delta-mutator law X.piece(mᵟ(X)) spelled once, so a caller need not name X twice.

Reach for it when you hold a CRDT outside a us.tractat.kuilt.quilter.Quilter and want the resulting whole state rather than a frame to broadcast:

val roster = ORSet.empty<String>()
.piece { it.add(alpha, "ada") }
.piece { it.add(bravo, "grace") }

Under a replicator, do not use this — quilter.mutate { it.add(replica, element) } takes the same lambda, applies it under the replicator's own lock, and broadcasts only the delta. Absorbing locally and handing the replicator the whole state is the O(state) mistake every mutator in this package now returns a Patch to prevent.