Function stm_core::unwrap_or_retry [] [src]

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

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)
    }
);