Skip to content

Commit a7a0225

Browse files
committed
Also add a From implementation for &mut Option<T> -> `Option<&mut T>'
1 parent 0cde1cb commit a7a0225

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/libcore/option.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,6 +1071,13 @@ impl<'a, T> From<&'a Option<T>> for Option<&'a T> {
10711071
}
10721072
}
10731073

1074+
#[stable(feature = "option_ref_from_ref_option", since = "1.30.0")]
1075+
impl<'a, T> From<&'a mut Option<T>> for Option<&'a mut T> {
1076+
fn from(o: &'a mut Option<T>) -> Option<&'a mut T> {
1077+
o.as_mut()
1078+
}
1079+
}
1080+
10741081
/////////////////////////////////////////////////////////////////////////////
10751082
// The Option Iterators
10761083
/////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)