let mut futures = vec::from_fn(1000, |ind| do extra::future::spawn { partial_sum(ind) });
let mut final_res = 0f64;
- for futures.each_mut |ft| {
+ for futures.mut_iter().advance |ft| {
final_res += ft.get();
}
println(fmt!("π^2/6 is not far from : %?", final_res));
impl<T> Mutable for Deque<T> {
/// Clear the deque, removing all values.
fn clear(&mut self) {
- for self.elts.each_mut |x| { *x = None }
+ for self.elts.mut_iter().advance |x| { *x = None }
self.nelts = 0;
self.lo = 0;
self.hi = 0;
fn each_reverse(&self, blk: &fn(&A) -> bool) -> bool;
}
-pub trait MutableIter<A>: BaseIter<A> {
- fn each_mut(&mut self, blk: &fn(&mut A) -> bool) -> bool;
-}
-
pub trait ExtendedIter<A> {
fn eachi(&self, blk: &fn(uint, v: &A) -> bool) -> bool;
fn all(&self, blk: &fn(&A) -> bool) -> bool;
pub use char::Char;
pub use container::{Container, Mutable, Map, Set};
pub use hash::Hash;
-pub use old_iter::{BaseIter, ReverseIter, MutableIter, ExtendedIter, EqIter};
+pub use old_iter::{BaseIter, ReverseIter, ExtendedIter, EqIter};
pub use old_iter::{CopyableIter, CopyableOrderedIter, CopyableNonstrictIter};
pub use iter::{Times, FromIter};
pub use iterator::{Iterator, IteratorUtil};
fn size_hint(&self) -> Option<uint> { Some(self.len()) }
}
-impl<'self,A> old_iter::MutableIter<A> for &'self mut [A] {
- #[inline(always)]
- fn each_mut<'a>(&'a mut self, blk: &fn(v: &'a mut A) -> bool) -> bool {
- self.mut_iter().advance(blk)
- }
-}
-
-// FIXME(#4148): This should be redundant
-impl<A> old_iter::MutableIter<A> for ~[A] {
- #[inline(always)]
- fn each_mut<'a>(&'a mut self, blk: &fn(v: &'a mut A) -> bool) -> bool {
- self.mut_iter().advance(blk)
- }
-}
-
-// FIXME(#4148): This should be redundant
-impl<A> old_iter::MutableIter<A> for @mut [A] {
- #[inline(always)]
- fn each_mut(&mut self, blk: &fn(v: &mut A) -> bool) -> bool {
- self.mut_iter().advance(blk)
- }
-}
-
impl<'self,A> old_iter::ExtendedIter<A> for &'self [A] {
pub fn eachi(&self, blk: &fn(uint, v: &A) -> bool) -> bool {
old_iter::eachi(self, blk)
thread_ring(0, msg_per_task, num_chan.take(), num_port);
// synchronize
- for futures.each_mut |f| {
+ for futures.mut_iter().advance |f| {
f.get()
}
thread_ring(0, msg_per_task, num_chan.take(), num_port);
// synchronize
- for futures.each_mut |f| {
+ for futures.mut_iter().advance |f| {
let _ = f.get();
}
thread_ring(0, msg_per_task, num_chan.take(), num_port);
// synchronize
- for futures.each_mut |f| {
+ for futures.mut_iter().advance |f| {
let _ = f.get();
}