Also add a From implementation for &mut Option<T> -> `Option<&mut T>'

This commit is contained in:
Georg Semmler 2018-08-10 14:21:17 +02:00
parent 0cde1cbb10
commit a7a0225a28
No known key found for this signature in database
GPG Key ID: A87BCEE5205CE489

View File

@ -1071,6 +1071,13 @@ impl<'a, T> From<&'a Option<T>> for Option<&'a T> {
}
}
#[stable(feature = "option_ref_from_ref_option", since = "1.30.0")]
impl<'a, T> From<&'a mut Option<T>> for Option<&'a mut T> {
fn from(o: &'a mut Option<T>) -> Option<&'a mut T> {
o.as_mut()
}
}
/////////////////////////////////////////////////////////////////////////////
// The Option Iterators
/////////////////////////////////////////////////////////////////////////////