forked from Orchid/orchid
exec working up to halt
clean shutdown doesn't for some reason
This commit is contained in:
@@ -28,9 +28,15 @@ impl ExprStore {
|
||||
},
|
||||
}
|
||||
}
|
||||
pub fn take_expr(&self, ticket: api::ExprTicket) {
|
||||
(self.0.exprs.borrow_mut().entry(ticket))
|
||||
.and_replace_entry_with(|_, (rc, rt)| (1 < rc).then_some((rc - 1, rt)));
|
||||
pub fn take_expr(&self, ticket: api::ExprTicket) -> Option<Expr> {
|
||||
match self.0.exprs.borrow_mut().entry(ticket) {
|
||||
Entry::Vacant(_) => None,
|
||||
Entry::Occupied(oe) if oe.get().0 == 1 => Some(oe.remove().1),
|
||||
Entry::Occupied(mut oe) => {
|
||||
oe.get_mut().0 -= 1;
|
||||
Some(oe.get().1.clone())
|
||||
},
|
||||
}
|
||||
}
|
||||
#[must_use]
|
||||
pub fn get_expr(&self, ticket: api::ExprTicket) -> Option<Expr> {
|
||||
|
||||
Reference in New Issue
Block a user