diff options
| author | Daniel Micay <danielmicay@gmail.com> | 2013-03-09 16:23:25 -0500 |
|---|---|---|
| committer | Daniel Micay <danielmicay@gmail.com> | 2013-03-09 16:27:15 -0500 |
| commit | 06a336ae791ea8a8e618ff43a97b1e6e510c6601 (patch) | |
| tree | 4006fea627a82f42ca620af6668567df5f3bca08 /src/libcore/vec.rs | |
| parent | 1cde7e6bc266af836e0695be7282257838eee05a (diff) | |
| download | rust-06a336ae791ea8a8e618ff43a97b1e6e510c6601.tar.gz rust-06a336ae791ea8a8e618ff43a97b1e6e510c6601.zip | |
vec: renovate the BaseIter impl
* add 'self region to the borrowed pointer parameter * rm workaround for #2263 * inline (wrappers) * iter-trait is gone
Diffstat (limited to 'src/libcore/vec.rs')
| -rw-r--r-- | src/libcore/vec.rs | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index 365de1ac3e2..6bcf396a150 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -2268,45 +2268,27 @@ pub mod bytes { // ___________________________________________________________________________ // ITERATION TRAIT METHODS -// -// This cannot be used with iter-trait.rs because of the region pointer -// required in the slice. impl<A> iter::BaseIter<A> for &self/[A] { - pub pure fn each(&self, blk: fn(v: &A) -> bool) { - // FIXME(#2263)---should be able to call each(self, blk) - for each(*self) |e| { - if (!blk(e)) { - return; - } - } - } + #[inline(always)] + pure fn each(&self, blk: fn(v: &'self A) -> bool) { each(*self, blk) } + #[inline(always)] pure fn size_hint(&self) -> Option<uint> { Some(len(*self)) } } // FIXME(#4148): This should be redundant impl<A> iter::BaseIter<A> for ~[A] { - pub pure fn each(&self, blk: fn(v: &A) -> bool) { - // FIXME(#2263)---should be able to call each(self, blk) - for each(*self) |e| { - if (!blk(e)) { - return; - } - } - } + #[inline(always)] + pure fn each(&self, blk: fn(v: &'self A) -> bool) { each(*self, blk) } + #[inline(always)] pure fn size_hint(&self) -> Option<uint> { Some(len(*self)) } } // FIXME(#4148): This should be redundant impl<A> iter::BaseIter<A> for @[A] { - pub pure fn each(&self, blk: fn(v: &A) -> bool) { - // FIXME(#2263)---should be able to call each(self, blk) - for each(*self) |e| { - if (!blk(e)) { - return; - } - } - } + #[inline(always)] + pure fn each(&self, blk: fn(v: &'self A) -> bool) { each(*self, blk) } + #[inline(always)] pure fn size_hint(&self) -> Option<uint> { Some(len(*self)) } } |
