Skip to content

Commit fa0ddf4

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 163243 b: refs/heads/snap-stage3 c: 19524f1 h: refs/heads/master i: 163241: 29648c2 163239: b792e06 v: v3
1 parent 3c571b6 commit fa0ddf4

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 9146a919b616e39e528e4d7100d16eef52f1f852
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 135c4ab5fe3c6f8befd379846988e7ca6234c116
4+
refs/heads/snap-stage3: 19524f1ed14d8da8b3d953812a3c3b461085d3dc
55
refs/heads/try: 20cbbffeefc1f35e2ea63afce7b42fbd79611d42
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/libcore/result.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ use slice::AsSlice;
239239
use iter::{Iterator, IteratorExt, DoubleEndedIterator, FromIterator, ExactSizeIterator};
240240
use option::Option;
241241
use option::Option::{None, Some};
242+
use ops::{FnMut, FnOnce};
242243

243244
/// `Result` is a type that represents either success (`Ok`) or failure (`Err`).
244245
///
@@ -466,7 +467,7 @@ impl<T, E> Result<T, E> {
466467
/// ```
467468
#[inline]
468469
#[unstable = "waiting for unboxed closures"]
469-
pub fn map<U>(self, op: |T| -> U) -> Result<U,E> {
470+
pub fn map<U, F: FnOnce(T) -> U>(self, op: F) -> Result<U,E> {
470471
match self {
471472
Ok(t) => Ok(op(t)),
472473
Err(e) => Err(e)
@@ -492,7 +493,7 @@ impl<T, E> Result<T, E> {
492493
/// ```
493494
#[inline]
494495
#[unstable = "waiting for unboxed closures"]
495-
pub fn map_err<F>(self, op: |E| -> F) -> Result<T,F> {
496+
pub fn map_err<F, O: FnOnce(E) -> F>(self, op: O) -> Result<T,F> {
496497
match self {
497498
Ok(t) => Ok(t),
498499
Err(e) => Err(op(e))
@@ -612,7 +613,7 @@ impl<T, E> Result<T, E> {
612613
/// ```
613614
#[inline]
614615
#[unstable = "waiting for unboxed closures"]
615-
pub fn and_then<U>(self, op: |T| -> Result<U, E>) -> Result<U, E> {
616+
pub fn and_then<U, F: FnOnce(T) -> Result<U, E>>(self, op: F) -> Result<U, E> {
616617
match self {
617618
Ok(t) => op(t),
618619
Err(e) => Err(e),
@@ -666,7 +667,7 @@ impl<T, E> Result<T, E> {
666667
/// ```
667668
#[inline]
668669
#[unstable = "waiting for unboxed closures"]
669-
pub fn or_else<F>(self, op: |E| -> Result<T, F>) -> Result<T, F> {
670+
pub fn or_else<F, O: FnOnce(E) -> Result<T, F>>(self, op: O) -> Result<T, F> {
670671
match self {
671672
Ok(t) => Ok(t),
672673
Err(e) => op(e),
@@ -708,7 +709,7 @@ impl<T, E> Result<T, E> {
708709
/// ```
709710
#[inline]
710711
#[unstable = "waiting for conventions"]
711-
pub fn unwrap_or_else(self, op: |E| -> T) -> T {
712+
pub fn unwrap_or_else<F: FnOnce(E) -> T>(self, op: F) -> T {
712713
match self {
713714
Ok(t) => t,
714715
Err(e) => op(e)
@@ -904,10 +905,11 @@ impl<A, E, V: FromIterator<A>> FromIterator<Result<A, E>> for Result<V, E> {
904905
pub fn fold<T,
905906
V,
906907
E,
908+
F: FnMut(V, T) -> V,
907909
Iter: Iterator<Result<T, E>>>(
908910
mut iterator: Iter,
909911
mut init: V,
910-
f: |V, T| -> V)
912+
mut f: F)
911913
-> Result<V, E> {
912914
for t in iterator {
913915
match t {

0 commit comments

Comments
 (0)