core: Improve the docs and signature of vec::iter2
This commit is contained in:
@@ -773,11 +773,19 @@ fn iter_between<T>(v: [const T], start: uint, end: uint, f: fn(T)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[doc = "Iterates over two vectors in parallel"]
|
#[doc = "
|
||||||
|
Iterates over two vectors simultaneously
|
||||||
|
|
||||||
|
# Failure
|
||||||
|
|
||||||
|
Both vectors must have the same length
|
||||||
|
"]
|
||||||
#[inline]
|
#[inline]
|
||||||
fn iter2<U, T>(v: [ U], v2: [const T], f: fn(U, T)) {
|
fn iter2<U, T>(v1: [const U], v2: [const T], f: fn(U, T)) {
|
||||||
let mut i = 0;
|
assert len(v1) == len(v2);
|
||||||
for elt in v { f(elt, v2[i]); i += 1; }
|
uint::range(0u, len(v1)) {|i|
|
||||||
|
f(v1[i], v2[i])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[doc = "
|
#[doc = "
|
||||||
|
|||||||
Reference in New Issue
Block a user