diff options
| author | Ben Blum <bblum@andrew.cmu.edu> | 2012-07-31 13:21:15 -0400 |
|---|---|---|
| committer | Ben Blum <bblum@andrew.cmu.edu> | 2012-07-31 13:22:32 -0400 |
| commit | e7d26a491724f347059a2f89cc4da676b6d2c970 (patch) | |
| tree | 375bc36b6292353f3468d1e498497cc94d35a1ee | |
| parent | 09e893ba2e7158c8bc24bac8bd4fcecf2353c3d3 (diff) | |
| download | rust-e7d26a491724f347059a2f89cc4da676b6d2c970.tar.gz rust-e7d26a491724f347059a2f89cc4da676b6d2c970.zip | |
make option::map_default<T,U> instead of U:copy
| -rw-r--r-- | src/libcore/option.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 270ba90c704..074dd086926 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -88,7 +88,7 @@ pure fn get_default<T: copy>(opt: option<T>, def: T) -> T { alt opt { some(x) { x } none { def } } } -pure fn map_default<T, U: copy>(opt: option<T>, def: U, f: fn(T) -> U) -> U { +pure fn map_default<T, U>(opt: option<T>, +def: U, f: fn(T) -> U) -> U { //! Applies a function to the contained value or returns a default alt opt { none { def } some(t) { f(t) } } @@ -133,7 +133,7 @@ impl extensions<T> for option<T> { */ pure fn chain<U>(f: fn(T) -> option<U>) -> option<U> { chain(self, f) } /// Applies a function to the contained value or returns a default - pure fn map_default<U: copy>(def: U, f: fn(T) -> U) -> U + pure fn map_default<U>(+def: U, f: fn(T) -> U) -> U { map_default(self, def, f) } /// Performs an operation on the contained value or does nothing pure fn iter(f: fn(T)) { iter(self, f) } |
