Function atomically

Source
pub async fn atomically<T, F>(f: F) -> T
where F: Fn() -> Stm<T>,
Expand description

The primary verbs to interact with STM transactions. Create a new transaction and run f until it returns a successful result and can be committed without running into version conflicts.

Make sure f is free of any side effects, because it can be called repeatedly.