diff options
| author | Erick Tryzelaar <erick.tryzelaar@gmail.com> | 2011-12-09 10:22:16 -0800 |
|---|---|---|
| committer | Erick Tryzelaar <erick.tryzelaar@gmail.com> | 2011-12-09 10:22:24 -0800 |
| commit | e3a066bde87255ce83fc83a27c452f088993466c (patch) | |
| tree | b39f46c23af7f8a2d91513ced2689e29588f4d46 /src/libstd | |
| parent | 44ffd8e3aadccbceb544074a3b96e255d0d97325 (diff) | |
| download | rust-e3a066bde87255ce83fc83a27c452f088993466c.tar.gz rust-e3a066bde87255ce83fc83a27c452f088993466c.zip | |
Swap arg order for option::{may,maybe}
This lets us write the block syntax sugar:
option::may(x) { |y| … }
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/option.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/option.rs b/src/libstd/option.rs index 403cb47f47e..9ab74496d0b 100644 --- a/src/libstd/option.rs +++ b/src/libstd/option.rs @@ -70,7 +70,7 @@ Function: maybe Applies a function to the contained value or returns a default */ -fn maybe<T, U>(def: U, f: block(T) -> U, opt: t<T>) -> U { +fn maybe<T, U>(def: U, opt: t<T>, f: block(T) -> U) -> U { alt opt { none. { def } some(t) { f(t) } } } @@ -80,7 +80,7 @@ Function: may Performs an operation on the contained value or does nothing */ -fn may<T>(f: block(T), opt: t<T>) { +fn may<T>(opt: t<T>, f: block(T)) { alt opt { none. {/* nothing */ } some(t) { f(t); } } } |
