Skip to content

Commit 2b0aec2

Browse files
committed
---
yaml --- r: 30820 b: refs/heads/incoming c: 2340ef9 h: refs/heads/master v: v3
1 parent 0b17984 commit 2b0aec2

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9-
refs/heads/incoming: 7f7af5f2ceedf533d2d09a1a2afd8b53031e5a9a
9+
refs/heads/incoming: 2340ef96d54d488c53eeab1967a2347aebde38ca
1010
refs/heads/dist-snap: 2f32a1581f522e524009138b33b1c7049ced668d
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/libcore/vec.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,6 +1526,7 @@ impl<T: Copy> &[const T]: CopyableVector<T> {
15261526
}
15271527

15281528
trait ImmutableVector<T> {
1529+
pure fn view(start: uint, end: uint) -> &[T];
15291530
pure fn foldr<U: Copy>(z: U, p: fn(T, U) -> U) -> U;
15301531
pure fn map<U>(f: fn(v: &T) -> U) -> ~[U];
15311532
pure fn mapi<U>(f: fn(uint, v: &T) -> U) -> ~[U];
@@ -1544,6 +1545,10 @@ trait ImmutableEqVector<T: Eq> {
15441545

15451546
/// Extension methods for vectors
15461547
impl<T> &[T]: ImmutableVector<T> {
1548+
/// Return a slice that points into another slice.
1549+
pure fn view(start: uint, end: uint) -> &[T] {
1550+
view(self, start, end)
1551+
}
15471552
/// Reduce a vector from right to left
15481553
#[inline]
15491554
pure fn foldr<U: Copy>(z: U, p: fn(T, U) -> U) -> U { foldr(self, z, p) }
@@ -2804,17 +2809,14 @@ mod tests {
28042809
assert capacity(v) == 10u;
28052810
}
28062811

2807-
/*
28082812
#[test]
2809-
#[ignore] // region inference doesn't work well enough for this yet.
28102813
fn test_view() {
28112814
let v = ~[1, 2, 3, 4, 5];
2812-
let v = view(v, 1u, 3u);
2815+
let v = v.view(1u, 3u);
28132816
assert(len(v) == 2u);
28142817
assert(v[0] == 2);
28152818
assert(v[1] == 3);
28162819
}
2817-
*/
28182820
}
28192821

28202822
// Local Variables:

0 commit comments

Comments
 (0)