pub enum Claim<T> {
Claimed {
token: ClaimToken,
},
Completed(T),
InFlight,
}Expand description
The three things a claim can find, and the three responses a caller has.
Variants§
Claimed
The key was absent. This caller owns it and must either complete it with a result or abandon it.
In both cases the key stays reserved until one of them happens, which is what stops a second caller from taking it in between.
Fields
token: ClaimTokenThe token to present when recording or releasing.
Completed(T)
The key already completed. Hand the recorded result back and do not execute: the whole point is that the side effect does not run a second time.
InFlight
Another caller holds the key right now. Do not execute and do not steal it — the holder is a real request, and taking the key from it would run the same side effect twice from two callers.
Implementations§
Source§impl<T> Claim<T>
impl<T> Claim<T>
Sourcepub const fn is_execution_mine(&self) -> bool
pub const fn is_execution_mine(&self) -> bool
Whether this caller is the one that should execute.
Sourcepub const fn token(&self) -> Option<&ClaimToken>
pub const fn token(&self) -> Option<&ClaimToken>
The token, if the claim came back to this caller.