Skip to main content

claim

Function claim 

Source
pub fn claim(
    seen: &mut BTreeSet<IdemKey>,
    key: IdemKey,
) -> Result<IdemGuard, Duplicate>
Expand description

Claims key in the caller’s seen set, handing back the right to act once.

The set stays the caller’s state — kernel holds none — and the claim is the only way to add to it, so a key that is in the set is a key some caller was already given the right for.

§Errors

Duplicate when the key is already in the set, carrying that key so the caller can look up the answer it gave the first time.