Skip to content

Commit

Permalink
Move documentation for vec::windowed where it will be generated
Browse files Browse the repository at this point in the history
  • Loading branch information
emberian committed Apr 25, 2013
1 parent 92bf9b6 commit 91fb7b2
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/libcore/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1566,6 +1566,16 @@ pub fn each_permutation<T:Copy>(v: &[T], put: &fn(ts: &[T]) -> bool) {
}
}
// see doc below
#[cfg(stage0)] // XXX: lifetimes!
pub fn windowed<T>(n: uint, v: &[T], it: &fn(&[T]) -> bool) {
assert!(1u <= n);
if n > v.len() { return; }
for uint::range(0, v.len() - n + 1) |i| {
if !it(v.slice(i, i+n)) { return }
}
}
/**
* Iterate over all contiguous windows of length `n` of the vector `v`.
*
Expand All @@ -1580,14 +1590,6 @@ pub fn each_permutation<T:Copy>(v: &[T], put: &fn(ts: &[T]) -> bool) {
* ~~~
*
*/
#[cfg(stage0)] // XXX: lifetimes!
pub fn windowed<T>(n: uint, v: &[T], it: &fn(&[T]) -> bool) {
assert!(1u <= n);
if n > v.len() { return; }
for uint::range(0, v.len() - n + 1) |i| {
if !it(v.slice(i, i+n)) { return }
}
}
#[cfg(stage1)]
#[cfg(stage2)]
#[cfg(stage3)]
Expand Down

5 comments on commit 91fb7b2

@bors
Copy link
Contributor

@bors bors commented on 91fb7b2 Apr 25, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 91fb7b2 Apr 25, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging cmr/rust/incoming = 91fb7b2 into auto

@bors
Copy link
Contributor

@bors bors commented on 91fb7b2 Apr 25, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmr/rust/incoming = 91fb7b2 merged ok, testing candidate = 64412ec

@bors
Copy link
Contributor

@bors bors commented on 91fb7b2 Apr 26, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 91fb7b2 Apr 26, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding incoming to auto = 64412ec

Please sign in to comment.