Function async_stm::atomically_or_err_aux
source · [−]pub async fn atomically_or_err_aux<F, T, A, X>(
aux: A,
f: F
) -> Result<T, Box<dyn Error + Send + Sync>> where
X: Aux,
A: Fn() -> X,
F: Fn(&mut X) -> StmDynResult<T>,
Expand description
Like atomically_or_err
, but this version also takes an auxiliary transaction system.
Aux is passed explicitly to the closure as it’s more important to see which methods use it and which don’t, because it is ultimately an external dependency that needs to be carefully managed.
For example the method might need only read-only access, in which case a more permissive transaction can be constructed, than if we need write access to arbitrary data managed by that system.