std: add default implementations to Option
This commit is contained in:
parent
653400a7f0
commit
4a73c8eac7
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user