rust/src/libcore/iter-trait/dvec.rs

21 lines
416 B
Rust
Raw Normal View History

2012-08-14 18:54:13 -05:00
#[allow(non_camel_case_types)]
type IMPL_T<A> = dvec::DVec<A>;
2012-05-09 19:30:31 -05:00
/**
* Iterates through the current contents.
*
* Attempts to access this dvec during iteration will fail.
*/
2012-09-25 19:39:22 -05:00
pure fn EACH<A>(self: &IMPL_T<A>, f: fn(v: &A) -> bool) {
unsafe {
do self.swap |v| {
v.each(f);
move v
}
}
2012-05-09 19:30:31 -05:00
}
2012-09-25 19:39:22 -05:00
pure fn SIZE_HINT<A>(self: &IMPL_T<A>) -> Option<uint> {
2012-08-20 14:23:37 -05:00
Some(self.len())
2012-05-09 19:30:31 -05:00
}