core: impl From<T> for Option<T>

This commit is contained in:
Sean McArthur 2016-07-14 12:17:39 -07:00
parent fe5c439f69
commit fbfee42a2f

View File

@ -142,6 +142,7 @@
use self::Option::*;
use clone::Clone;
use convert::From;
use default::Default;
use iter::ExactSizeIterator;
use iter::{Iterator, DoubleEndedIterator, FromIterator, IntoIterator};
@ -754,6 +755,13 @@ impl<'a, T> IntoIterator for &'a mut Option<T> {
}
}
#[stable(since = "1.12.0", feature = "option_from")]
impl<T> From<T> for Option<T> {
fn from(val: T) -> Option<T> {
Some(val)
}
}
/////////////////////////////////////////////////////////////////////////////
// The Option Iterators
/////////////////////////////////////////////////////////////////////////////