make marble creation a weak claim

This commit is contained in:
Crispy 2025-03-15 20:13:48 +01:00
parent e7f424aadc
commit fa10b38f99
2 changed files with 41 additions and 28 deletions

View file

@ -485,3 +485,35 @@ impl Comparison {
}
}
}
impl Claim {
#[must_use]
/// returns `was_free`
pub fn claim(&mut self) -> bool {
let mut was_free = false;
*self = match self {
Claim::Free => {
was_free = true;
Claim::Claimed
}
Claim::ClaimedIndirect | Claim::BlockedIndirect => Claim::Claimed,
Claim::Claimed | Claim::Blocked => Claim::Blocked,
};
was_free
}
#[must_use]
/// returns `was_free`
pub fn claim_indirect(&mut self) -> bool {
let mut was_free = false;
*self = match self {
Claim::Free => {
was_free = true;
Claim::ClaimedIndirect
}
Claim::ClaimedIndirect => Claim::BlockedIndirect,
_ => *self,
};
was_free
}
}