pub struct UpdateOp { /* private fields */ }Expand description
Patch an existing entity, note, or edge’s mutable fields, carrying a
stage-time preimage scoped to exactly the fields the patch touches.
preimage’s populated fields must equal patch’s touched fields —
every field the patch sets or explicitly clears to null, and no field
the patch leaves unchanged — enforced at deserialize time, the same
discipline DeleteOp and MergeOp apply to their own preimages below.
An UpdateOp whose preimage and patch disagree on which fields changed
is unrepresentable — both the checked constructor and Deserialize
enforce the same congruence validation, so there is no construction path
that bypasses it.
Implementations§
Source§impl UpdateOp
impl UpdateOp
Sourcepub fn new(
target_id: Id128,
patch: UpdatePatch,
preimage: UpdatePreimage,
) -> Result<Self, String>
pub fn new( target_id: Id128, patch: UpdatePatch, preimage: UpdatePreimage, ) -> Result<Self, String>
Construct an UpdateOp, enforcing the congruence invariant:
preimage must target the same substrate as patch and populate
exactly the fields patch touches. This is the same invariant the
Deserialize impl enforces on the wire, so an incongruent update
cannot be built through either entry point.
Sourcepub fn patch(&self) -> &UpdatePatch
pub fn patch(&self) -> &UpdatePatch
The staged patch.
Sourcepub fn preimage(&self) -> &UpdatePreimage
pub fn preimage(&self) -> &UpdatePreimage
The field-scoped prior value the patch touches.