Skip to content

Commit e889427

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 163292 b: refs/heads/snap-stage3 c: d5c3326 h: refs/heads/master v: v3
1 parent e3802a5 commit e889427

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-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: 0055678f7a5f49fc5df93a38cc27fea4eb6ae416
4+
refs/heads/snap-stage3: d5c332688c83043dffcf14ef8fd6ba3fafdae55e
55
refs/heads/try: 20cbbffeefc1f35e2ea63afce7b42fbd79611d42
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/libcollections/vec.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ impl<T> Vec<T> {
206206
#[inline]
207207
#[unstable = "the naming is uncertain as well as this migrating to unboxed \
208208
closures in the future"]
209-
pub fn from_fn(length: uint, op: |uint| -> T) -> Vec<T> {
209+
pub fn from_fn<F>(length: uint, mut op: F) -> Vec<T> where F: FnMut(uint) -> T {
210210
unsafe {
211211
let mut xs = Vec::with_capacity(length);
212212
while xs.len < length {
@@ -289,7 +289,7 @@ impl<T> Vec<T> {
289289
/// ```
290290
#[inline]
291291
#[experimental]
292-
pub fn partition(self, f: |&T| -> bool) -> (Vec<T>, Vec<T>) {
292+
pub fn partition<F>(self, mut f: F) -> (Vec<T>, Vec<T>) where F: FnMut(&T) -> bool {
293293
let mut lefts = Vec::new();
294294
let mut rights = Vec::new();
295295

@@ -400,7 +400,7 @@ impl<T: Clone> Vec<T> {
400400
/// assert_eq!(odd, vec![1i, 3]);
401401
/// ```
402402
#[experimental]
403-
pub fn partitioned(&self, f: |&T| -> bool) -> (Vec<T>, Vec<T>) {
403+
pub fn partitioned<F>(&self, mut f: F) -> (Vec<T>, Vec<T>) where F: FnMut(&T) -> bool {
404404
let mut lefts = Vec::new();
405405
let mut rights = Vec::new();
406406

@@ -991,7 +991,7 @@ impl<T> Vec<T> {
991991
/// assert_eq!(vec, vec![2, 4]);
992992
/// ```
993993
#[unstable = "the closure argument may become an unboxed closure"]
994-
pub fn retain(&mut self, f: |&T| -> bool) {
994+
pub fn retain<F>(&mut self, mut f: F) where F: FnMut(&T) -> bool {
995995
let len = self.len();
996996
let mut del = 0u;
997997
{
@@ -1023,7 +1023,7 @@ impl<T> Vec<T> {
10231023
/// assert_eq!(vec, vec![0, 1, 0, 1, 2]);
10241024
/// ```
10251025
#[unstable = "this function may be renamed or change to unboxed closures"]
1026-
pub fn grow_fn(&mut self, n: uint, f: |uint| -> T) {
1026+
pub fn grow_fn<F>(&mut self, n: uint, mut f: F) where F: FnMut(uint) -> T {
10271027
self.reserve(n);
10281028
for i in range(0u, n) {
10291029
self.push(f(i));
@@ -1570,7 +1570,7 @@ impl<T> Vec<T> {
15701570
/// let newtyped_bytes = bytes.map_in_place(|x| Newtype(x));
15711571
/// assert_eq!(newtyped_bytes.as_slice(), [Newtype(0x11), Newtype(0x22)].as_slice());
15721572
/// ```
1573-
pub fn map_in_place<U>(self, f: |T| -> U) -> Vec<U> {
1573+
pub fn map_in_place<U, F>(self, mut f: F) -> Vec<U> where F: FnMut(T) -> U {
15741574
// FIXME: Assert statically that the types `T` and `U` have the same
15751575
// size.
15761576
assert!(mem::size_of::<T>() == mem::size_of::<U>());

0 commit comments

Comments
 (0)