Skip to content

Commit

Permalink
Also add a From implementation for &mut Option<T> -> `Option<&mut…
Browse files Browse the repository at this point in the history
… T>'
  • Loading branch information
weiznich committed Aug 10, 2018
1 parent 0cde1cb commit a7a0225
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/libcore/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
/////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit a7a0225

Please sign in to comment.