rm MutableIter

replaced with mutable implementations of Iterator
This commit is contained in:
Daniel Micay 2013-06-12 21:56:16 -04:00
parent 8111701604
commit d68be89e69
8 changed files with 6 additions and 33 deletions

View file

@ -327,7 +327,7 @@ fn main() {
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));

View file

@ -37,7 +37,7 @@ impl<T> Container for Deque<T> {
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;

View file

@ -33,10 +33,6 @@ pub trait ReverseIter<A>: BaseIter<A> {
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;

View file

@ -46,7 +46,7 @@ pub use cmp::{Eq, ApproxEq, Ord, TotalEq, TotalOrd, Ordering, Less, Equal, Great
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};

View file

@ -2487,29 +2487,6 @@ impl<A> old_iter::BaseIter<A> for @[A] {
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)

View file

@ -109,7 +109,7 @@ fn main() {
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()
}

View file

@ -99,7 +99,7 @@ fn main() {
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();
}

View file

@ -105,7 +105,7 @@ fn main() {
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();
}