Add a implementation of From for converting &'a Option<T> into

`Option<&'a T>`
This commit is contained in:
Georg Semmler 2018-08-09 11:02:08 +02:00
parent 76b69a604e
commit ef519c1de5
No known key found for this signature in database
GPG Key ID: A87BCEE5205CE489

View File

@ -1064,6 +1064,12 @@ fn from(val: T) -> Option<T> {
}
}
impl<'a, T> From<&'a Option<T>> for Option<&'a T> {
fn from(o: &'a Option<T>) -> Option<&'a T> {
o.as_ref()
}
}
/////////////////////////////////////////////////////////////////////////////
// The Option Iterators
/////////////////////////////////////////////////////////////////////////////