Skip to content

Commit 274377b

Browse files
committed
---
yaml --- r: 13543 b: refs/heads/master c: ff536f3 h: refs/heads/master i: 13541: 4ecb7bc 13539: 0bc3c76 13535: 74ef21d v: v3
1 parent 17b06b0 commit 274377b

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: f87c28b1225abd7f5d1328cca3c198be3b919b2e
2+
refs/heads/master: ff536f3fa59dc5d232724200e24af5eeae6f4b54
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/libcore/option.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,26 @@ pure fn unwrap<T>(-opt: option<T>) -> T unsafe {
8787
ret liberated_value;
8888
}
8989

90-
impl extensions<T:copy> for option<T> {
90+
impl extensions<T> for option<T> {
9191
#[doc = "
9292
Update an optional value by optionally running its content through a
9393
function that returns an option.
9494
"]
9595
fn chain<U>(f: fn(T) -> option<U>) -> option<U> { chain(self, f) }
96-
#[doc = "Returns the contained value or a default"]
97-
fn get_default(def: T) -> T { get_default(self, def) }
9896
#[doc = "Applies a function to the contained value or returns a default"]
9997
fn map_default<U: copy>(def: U, f: fn(T) -> U) -> U
10098
{ map_default(self, def, f) }
10199
#[doc = "Performs an operation on the contained value or does nothing"]
102100
fn iter(f: fn(T)) { iter(self, f) }
101+
#[doc = "Returns true if the option equals `none`"]
102+
fn is_none() -> bool { is_none(self) }
103+
#[doc = "Returns true if the option contains some value"]
104+
fn is_some() -> bool { is_some(self) }
105+
#[doc = "Maps a `some` value from one type to another"]
106+
fn map<U:copy>(f: fn(T) -> U) -> option<U> { map(self, f) }
107+
}
103108

109+
impl extensions<T: copy> for option<T> {
104110
#[doc = "
105111
Gets the value out of an option
106112
@@ -109,12 +115,7 @@ impl extensions<T:copy> for option<T> {
109115
Fails if the value equals `none`
110116
"]
111117
fn get() -> T { get(self) }
112-
#[doc = "Returns true if the option equals `none`"]
113-
fn is_none() -> bool { is_none(self) }
114-
#[doc = "Returns true if the option contains some value"]
115-
fn is_some() -> bool { is_some(self) }
116-
#[doc = "Maps a `some` value from one type to another"]
117-
fn map<U:copy>(f: fn(T) -> U) -> option<U> { map(self, f) }
118+
fn get_default(def: T) -> T { get_default(self, def) }
118119
}
119120

120121
#[test]

0 commit comments

Comments
 (0)