stm_core/result.rs
1
2#[derive(Eq, PartialEq, Clone, Copy, Debug)]
3pub enum StmError {
4 /// The call failed, because a variable, the computation
5 /// depends on, has changed.
6 Failure,
7
8 /// `retry` was called.
9 ///
10 /// It may block until at least one read variable has changed.
11 Retry,
12}
13
14/// `StmResult` is a result of a single step of a STM calculation.
15///
16/// It informs of success or the type of failure. Normally you should not use
17/// it directly. Especially recovering from an error, e.g. by using `action1.or(action2)`
18/// can break the semantics of stm, and cause delayed wakeups or deadlocks.
19///
20/// For the later case, there is the `transaction.or(action1, action2)`, that
21/// is safe to use.
22pub type StmResult<T> = Result<T, StmError>;