feat: EvalState.weak_ref()

(cherry picked from commit d7a72c82ebfbfbb1b58fa15044b63648b2109260)
This commit is contained in:
Robert Hensing 2024-06-27 16:01:40 +02:00
parent e0dead151e
commit 01c9d0b2d3
2 changed files with 57 additions and 2 deletions

View file

@ -39,6 +39,8 @@ pub struct StoreWeak {
}
impl StoreWeak {
/// Upgrade the weak reference to a proper [Store].
///
/// If no normal reference to the [Store] is around anymore elsewhere, this fails by returning `None`.
pub fn upgrade(&self) -> Option<Store> {
self.inner.upgrade().map(|inner| Store {
inner,