Could I have something such as
struct LongLivedStruct { // lasts for a long time
possibleRef: ShortLivedRc<SomeTrait> // SomeTrait will be freed soon
}
such that I can try to dereference it later:
impl LongLivedStruct {
fn try_to_do_something(&self) -> &str {
match &self.possibleRef.try_deref() {
Ok(_) => "Value still exists, we can do something with it!"
Err(_) => "Value has already been deconstructed"
}
}
}
without it panicking if it no longer exists?