std: add default implementations to Option

This commit is contained in:
Erick Tryzelaar 2013-09-09 19:29:11 -07:00
parent 653400a7f0
commit 4a73c8eac7

View File

@ -43,6 +43,7 @@
use clone::Clone;
use cmp::{Eq,Ord};
use default::Default;
use util;
use num::Zero;
use iter;
@ -349,6 +350,10 @@ pub fn while_some(self, blk: &fn(v: T) -> Option<T>) {
}
}
impl<T> Default for Option<T> {
fn default() -> Option<T> { None }
}
impl<T:Zero> Option<T> {
/// Returns the contained value or zero (for this type)
#[inline]