Merge pull request #34 from gifnksm/master

Update to iter stabilization.
This commit is contained in:
Alex Crichton 2014-11-27 14:15:32 -06:00
commit bc9f83e7d8
3 changed files with 8 additions and 8 deletions

View File

@ -740,14 +740,14 @@ impl FromStrRadix for BigUint {
}
impl<T: Iterator<BigUint>> AdditiveIterator<BigUint> for T {
fn sum(&mut self) -> BigUint {
fn sum(self) -> BigUint {
let init: BigUint = Zero::zero();
self.fold(init, |acc, x| acc + x)
}
}
impl<T: Iterator<BigUint>> MultiplicativeIterator<BigUint> for T {
fn product(&mut self) -> BigUint {
fn product(self) -> BigUint {
let init: BigUint = One::one();
self.fold(init, |acc, x| acc * x)
}
@ -1388,14 +1388,14 @@ impl<R: Rng> RandBigInt for R {
}
impl<T: Iterator<BigInt>> AdditiveIterator<BigInt> for T {
fn sum(&mut self) -> BigInt {
fn sum(self) -> BigInt {
let init: BigInt = Zero::zero();
self.fold(init, |acc, x| acc + x)
}
}
impl<T: Iterator<BigInt>> MultiplicativeIterator<BigInt> for T {
fn product(&mut self) -> BigInt {
fn product(self) -> BigInt {
let init: BigInt = One::one();
self.fold(init, |acc, x| acc * x)
}

View File

@ -176,14 +176,14 @@ impl<T: fmt::Show + Num + PartialOrd> fmt::Show for Complex<T> {
}
impl<A: Clone + Num, T: Iterator<Complex<A>>> AdditiveIterator<Complex<A>> for T {
fn sum(&mut self) -> Complex<A> {
fn sum(self) -> Complex<A> {
let init: Complex<A> = Zero::zero();
self.fold(init, |acc, x| acc + x)
}
}
impl<A: Clone + Num, T: Iterator<Complex<A>>> MultiplicativeIterator<Complex<A>> for T {
fn product(&mut self) -> Complex<A> {
fn product(self) -> Complex<A> {
let init: Complex<A> = One::one();
self.fold(init, |acc, x| acc * x)
}

View File

@ -384,14 +384,14 @@ impl<T: FromStrRadix + Clone + Integer + PartialOrd>
}
impl<A: Clone + Integer + PartialOrd, T: Iterator<Ratio<A>>> AdditiveIterator<Ratio<A>> for T {
fn sum(&mut self) -> Ratio<A> {
fn sum(self) -> Ratio<A> {
let init: Ratio<A> = Zero::zero();
self.fold(init, |acc, x| acc + x)
}
}
impl<A: Clone + Integer + PartialOrd, T: Iterator<Ratio<A>>> MultiplicativeIterator<Ratio<A>> for T {
fn product(&mut self) -> Ratio<A> {
fn product(self) -> Ratio<A> {
let init: Ratio<A> = One::one();
self.fold(init, |acc, x| acc * x)
}