We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fe5c439 commit fbfee42Copy full SHA for fbfee42
src/libcore/option.rs
@@ -142,6 +142,7 @@
142
use self::Option::*;
143
144
use clone::Clone;
145
+use convert::From;
146
use default::Default;
147
use iter::ExactSizeIterator;
148
use iter::{Iterator, DoubleEndedIterator, FromIterator, IntoIterator};
@@ -754,6 +755,13 @@ impl<'a, T> IntoIterator for &'a mut Option<T> {
754
755
}
756
757
758
+#[stable(since = "1.12.0", feature = "option_from")]
759
+impl<T> From<T> for Option<T> {
760
+ fn from(val: T) -> Option<T> {
761
+ Some(val)
762
+ }
763
+}
764
+
765
/////////////////////////////////////////////////////////////////////////////
766
// The Option Iterators
767
0 commit comments