diff options
| author | Marijn Haverbeke <marijnh@gmail.com> | 2012-01-05 15:35:37 +0100 |
|---|---|---|
| committer | Marijn Haverbeke <marijnh@gmail.com> | 2012-01-05 15:50:02 +0100 |
| commit | 60ae1590af034755b5cb1e1e71f2240a710299a2 (patch) | |
| tree | 605d11f071a776c0ca33dcfea0a774379b0880bb /src/libcore/either.rs | |
| parent | 1f71a0f48d18d80ff3be6970d582c5a67f976329 (diff) | |
Switch to new param kind bound syntax
And remove support for the old syntax
Diffstat (limited to 'src/libcore/either.rs')
| -rw-r--r-- | src/libcore/either.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libcore/either.rs b/src/libcore/either.rs index f3571ea5bcf..e6956930686 100644 --- a/src/libcore/either.rs +++ b/src/libcore/either.rs @@ -39,7 +39,7 @@ Function: lefts Extracts from a vector of either all the left values. */ -fn lefts<copy T, U>(eithers: [t<T, U>]) -> [T] { +fn lefts<T: copy, U>(eithers: [t<T, U>]) -> [T] { let result: [T] = []; for elt: t<T, U> in eithers { alt elt { left(l) { result += [l]; } _ {/* fallthrough */ } } @@ -52,7 +52,7 @@ Function: rights Extracts from a vector of either all the right values */ -fn rights<T, copy U>(eithers: [t<T, U>]) -> [U] { +fn rights<T, U: copy>(eithers: [t<T, U>]) -> [U] { let result: [U] = []; for elt: t<T, U> in eithers { alt elt { right(r) { result += [r]; } _ {/* fallthrough */ } } @@ -68,7 +68,7 @@ Extracts from a vector of either all the left values and right values Returns a structure containing a vector of left values and a vector of right values. */ -fn partition<copy T, copy U>(eithers: [t<T, U>]) +fn partition<T: copy, U: copy>(eithers: [t<T, U>]) -> {lefts: [T], rights: [U]} { let lefts: [T] = []; let rights: [U] = []; @@ -83,7 +83,7 @@ Function: flip Flips between left and right of a given either */ -pure fn flip<copy T, copy U>(eith: t<T, U>) -> t<U, T> { +pure fn flip<T: copy, U: copy>(eith: t<T, U>) -> t<U, T> { alt eith { right(r) { left(r) } left(l) { right(l) } @@ -96,7 +96,7 @@ Function: to_result Converts either::t to a result::t, making the "right" choice an ok result, and the "left" choice a fail */ -pure fn to_result<copy T, copy U>(eith: t<T, U>) -> result::t<U, T> { +pure fn to_result<T: copy, U: copy>(eith: t<T, U>) -> result::t<U, T> { alt eith { right(r) { result::ok(r) } left(l) { result::err(l) } |
