From fbfee42a2f65b7a3d4acd0d9d029bb75208ac800 Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Thu, 14 Jul 2016 12:17:39 -0700 Subject: [PATCH] core: impl From for Option --- src/libcore/option.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 045c1f9feaf..fe508adb713 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -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 { } } +#[stable(since = "1.12.0", feature = "option_from")] +impl From for Option { + fn from(val: T) -> Option { + Some(val) + } +} + ///////////////////////////////////////////////////////////////////////////// // The Option Iterators /////////////////////////////////////////////////////////////////////////////