diff options
| author | Brian J. Burg <burg@cs.washington.edu> | 2012-11-12 17:53:08 -0800 |
|---|---|---|
| committer | Brian J. Burg <burg@cs.washington.edu> | 2012-11-12 17:53:08 -0800 |
| commit | 37ed7fcaae1477cd85985886b5f8a4514bf98d0e (patch) | |
| tree | e16f7daf120a56a9f6f1be4549f2e20de250227c /src | |
| parent | a5718ba377fbc915618062d7562229a4eb754c9f (diff) | |
Fix Result::chain, Result::chain_err to not require Copy bounds.
Diffstat (limited to 'src')
| -rw-r--r-- | src/libcore/result.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 3015e893700..2df2974d0ba 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -103,11 +103,11 @@ pub pure fn to_either<T: Copy, U: Copy>(res: &Result<U, T>) * ok(parse_bytes(buf)) * } */ -pub fn chain<T, U: Copy, V: Copy>(res: Result<T, V>, op: fn(t: T) +pub fn chain<T, U, V>(res: Result<T, V>, op: fn(t: T) -> Result<U, V>) -> Result<U, V> { match move res { Ok(move t) => op(move t), - Err(move e) => Err(e) + Err(move e) => Err(move e) } } @@ -119,13 +119,13 @@ pub fn chain<T, U: Copy, V: Copy>(res: Result<T, V>, op: fn(t: T) * immediately returned. This function can be used to pass through a * successful result while handling an error. */ -pub fn chain_err<T: Copy, U: Copy, V: Copy>( +pub fn chain_err<T, U, V>( res: Result<T, V>, op: fn(t: V) -> Result<T, U>) -> Result<T, U> { match move res { - Ok(move t) => Ok(t), - Err(move v) => op(v) + Ok(move t) => Ok(move t), + Err(move v) => op(move v) } } |
