pub fn foo<A, B>(x: Ref<(A, Option<B>)>) -> Ref<Option<(A, B)>> {
Ref::map(x, |(a, ob)| match ob {
None => None,
Some(b) => Some((a, b)),
})
}
I understand that the above code does not work. My question is: is there a way to make it work? The problem I seem to run into is that any & we generate is unlikely to live long enough.
This, once again, is using Ref in std::cell - Rust