pub struct Patch { /* private fields */ }Expand description
The recorded effect of one committed transaction. Re-apply it with
Patch::apply (redo) or undo it with Patch::revert.
A patch only applies to the mesh that produced it, at the matching revision:
revert needs the mesh exactly as the commit left it, apply needs it exactly as
it was before the commit.
Implementations§
Source§impl Patch
impl Patch
Sourcepub fn base_revision(&self) -> u64
pub fn base_revision(&self) -> u64
Mesh revision before the commit.
Sourcepub fn apply(&self, mesh: &mut Mesh) -> Result<ChangeSet>
pub fn apply(&self, mesh: &mut Mesh) -> Result<ChangeSet>
Re-applies the patch (redo). The mesh must be at Patch::base_revision.
If memory runs out, the mesh is left unchanged.
Sourcepub fn revert(&self, mesh: &mut Mesh) -> Result<ChangeSet>
pub fn revert(&self, mesh: &mut Mesh) -> Result<ChangeSet>
Undoes the patch. The mesh must be at Patch::revision.
Sourcepub fn release(&self, mesh: &mut Mesh, side: PatchSide)
pub fn release(&self, mesh: &mut Mesh, side: PatchSide)
Returns the slots this patch reserves to the mesh’s free lists, for a patch
that is dropped without being undone or redone again: the removed slots for
PatchSide::Undoable, the created slots for PatchSide::Redoable.
Does nothing when the patch is stale (another mesh, or the mesh was compacted),
because its slots no longer exist.
Call it at most once per patch, and only when the patch is discarded from a history. Calling it twice, or while a history still holds the patch, corrupts slot reuse.