pub fn with_protection<R>(
tx: &mut Transaction<'_>,
vertices: &[VertexId],
weights: &[f32],
op: impl FnOnce(&mut Transaction<'_>) -> Result<R>,
) -> Result<R>Expand description
Runs op in tx, then scales each listed vertex’s move by its weight:
0 leaves the vertex at the bits it had before op, 1 keeps the whole
move, and values in between land on the straight line between the two.
Vertices that end where they started are not written. op must leave the
listed vertices alive. What op reports describes its own move, before
the scaling: a neighbor it computed against a protected vertex’s moved
position keeps that result.
§Errors
OpsError::InvalidInputwhen the lists differ in length, a weight is not in[0, 1], or a listed vertex is not alive;ophas not run then.- Whatever
opreturns, andOpsError::Storewhen memory runs out. The caller’s transaction should then be rolled back.