make marble creation a weak claim
This commit is contained in:
parent
e7f424aadc
commit
fa10b38f99
2 changed files with 41 additions and 28 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue