pub fn optionally<T, F>(tx: &mut Transaction, f: F) -> StmResult<Option<T>>Expand description
Optionally run a transaction f. If f fails with a retry(), it does
not cancel the whole transaction, but returns None.
Note that optionally does not always recover the function, if
inconsistencies where found.
unwrap_or_retry is the inverse of optionally.
ยงExample
let x:Option<i32> = atomically(|tx|
optionally(tx, |_| retry()));
assert_eq!(x, None);