fast_stm

Function unwrap_or_retry

Source
pub fn unwrap_or_retry<T>(option: Option<T>) -> StmResult<T>
Expand description

Unwrap Option or call retry if it is None.

optionally is the inverse of unwrap_or_retry.

ยงExample

let x = TVar::new(Some(42));

atomically(|tx| {
        let inner = unwrap_or_retry(x.read(tx)?)?;
        assert_eq!(inner, 42); // inner is always 42.
        Ok(inner)
    }
);