diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-10-27 16:27:47 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-10-27 16:27:47 -0700 |
| commit | 2b85817af8bc4bdfbb155f15367c3ebee09eb743 (patch) | |
| tree | d26f857850b2ff7873f9b19bef660d81ebda6d7a /src | |
| parent | cf2624106c36d2dd37ff357bc1eb48586719d015 (diff) | |
| download | rust-2b85817af8bc4bdfbb155f15367c3ebee09eb743.tar.gz rust-2b85817af8bc4bdfbb155f15367c3ebee09eb743.zip | |
Convert various functions in std to take lambda blocks
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/fun_treemap.rs | 2 | ||||
| -rw-r--r-- | src/lib/treemap.rs | 2 | ||||
| -rw-r--r-- | src/lib/vec.rs | 6 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/fun_treemap.rs b/src/lib/fun_treemap.rs index 4e0aea3f319..1126a13d449 100644 --- a/src/lib/fun_treemap.rs +++ b/src/lib/fun_treemap.rs @@ -84,7 +84,7 @@ Function: traverse Visit all pairs in the map in order. */ -fn traverse<K, V>(m: treemap<K, V>, f: fn(K, V)) { +fn traverse<K, V>(m: treemap<K, V>, f: block(K, V)) { alt *m { empty. { } node(@k, @v, _, _) { diff --git a/src/lib/treemap.rs b/src/lib/treemap.rs index 68d732449c6..84fff4992f0 100644 --- a/src/lib/treemap.rs +++ b/src/lib/treemap.rs @@ -83,7 +83,7 @@ Function: traverse Visit all pairs in the map in order. */ -fn traverse<K, V>(m: treemap<K, V>, f: fn@(K, V)) { +fn traverse<K, V>(m: treemap<K, V>, f: block(K, V)) { alt *m { empty. { } node(k, v, _, _) { diff --git a/src/lib/vec.rs b/src/lib/vec.rs index c4d68590b4d..3763a13a37a 100644 --- a/src/lib/vec.rs +++ b/src/lib/vec.rs @@ -48,7 +48,7 @@ Type: init_op A function used to initialize the elements of a vector. */ -type init_op<T> = fn@(uint) -> T; +type init_op<T> = block(uint) -> T; /* Function: init_fn @@ -327,7 +327,7 @@ v - The vector to grow n - The number of elements to add init_fn - A function to call to retreive each appended element's value */ -fn grow_fn<T>(&v: [T], n: uint, init_fn: fn(uint) -> T) { +fn grow_fn<T>(&v: [T], n: uint, init_fn: block(uint) -> T) { reserve(v, next_power_of_two(len(v) + n)); let i: uint = 0u; while i < n { v += [init_fn(i)]; i += 1u; } @@ -513,7 +513,7 @@ Function: position_pred Find the first index for which the value matches some predicate */ -fn position_pred<T>(f: fn(T) -> bool, v: [T]) -> option::t<uint> { +fn position_pred<T>(f: block(T) -> bool, v: [T]) -> option::t<uint> { let i: uint = 0u; while i < len(v) { if f(v[i]) { ret some::<uint>(i); } i += 1u; } ret none; |
