Skip to content

Commit

Permalink
core: impl From<T> for Option<T>
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmonstar committed Jul 20, 2016
1 parent fe5c439 commit fbfee42
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/libcore/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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
/////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit fbfee42

Please sign in to comment.