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

21 lines
428 B
Rust
Raw Normal View History

2012-08-14 18:54:13 -05:00
#[allow(non_camel_case_types)]
2012-10-01 19:25:21 -05:00
pub 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-10-01 19:25:21 -05:00
pub 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-10-01 19:25:21 -05:00
pub 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
}