Skip to content

Commit 9bff2f2

Browse files
committed
core: Add each, eachi to vec::extensions
1 parent 5d54def commit 9bff2f2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: src/libcore/vec.rs

+6
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,12 @@ impl extensions<T> for [const T] {
964964
#[doc = "Returns the number of elements that are equal to a given value"]
965965
#[inline]
966966
fn count(x: T) -> uint { count(self, x) }
967+
#[doc = "Iterates over a vector, with option to break"]
968+
#[inline]
969+
fn each<T>(f: fn(T) -> bool) { each(self, f) }
970+
#[doc = "Iterates over a vector's elements and indices"]
971+
#[inline]
972+
fn eachi<T>(f: fn(uint, T) -> bool) { eachi(self, f) }
967973
#[doc = "Reduce a vector from left to right"]
968974
#[inline]
969975
fn foldl<U: copy>(z: U, p: fn(U, T) -> U) -> U { foldl(z, self, p) }

0 commit comments

Comments
 (0)