It would be nice to bubble up errors in the Ref::map
and RefMut::map
functions. I think this is a pretty non-controversial addition:
impl<'b, T> Ref<'b, T>
where
T: ?Sized,
{
pub fn try_map<U, E, F>(orig: Ref<'b, T>, f: F) -> Result<Ref<'b, U>, E>
where
F: FnOnce(&T) -> Result<&U, E>
U: ?Sized,
{ ... }
}
Does anyone see any issues with this? Like I said, it seems pretty non-controversial.