bench: fix fallout

This commit is contained in:
Jorge Aparicio 2015-01-02 14:54:01 -05:00
parent 91eeb641cd
commit 6c0ad5b564
4 changed files with 17 additions and 7 deletions

View File

@ -75,7 +75,9 @@ impl<'a> AAGen<'a> {
AAGen { rng: rng, data: data }
}
}
impl<'a> Iterator<u8> for AAGen<'a> {
impl<'a> Iterator for AAGen<'a> {
type Item = u8;
fn next(&mut self) -> Option<u8> {
let r = self.rng.gen();
self.data.iter()
@ -85,7 +87,7 @@ impl<'a> Iterator<u8> for AAGen<'a> {
}
}
fn make_fasta<W: Writer, I: Iterator<u8>>(
fn make_fasta<W: Writer, I: Iterator<Item=u8>>(
wr: &mut W, header: &str, mut it: I, mut n: uint)
-> std::io::IoResult<()>
{

View File

@ -194,7 +194,9 @@ impl Table {
}
}
impl<'a> Iterator<&'a Entry> for Items<'a> {
impl<'a> Iterator for Items<'a> {
type Item = &'a Entry;
fn next(&mut self) -> Option<&'a Entry> {
let ret = match self.cur {
None => {

View File

@ -57,7 +57,9 @@ struct Iterate<'a, T> {
f: |&T|: 'a -> T,
next: T
}
impl<'a, T> Iterator<T> for Iterate<'a, T> {
impl<'a, T> Iterator for Iterate<'a, T> {
type Item = T;
fn next(&mut self) -> Option<T> {
let mut res = (self.f)(&self.next);
std::mem::swap(&mut res, &mut self.next);
@ -78,7 +80,9 @@ impl<'a, T> List<'a, T> {
ListIterator{cur: self}
}
}
impl<'a, T> Iterator<&'a T> for ListIterator<'a, T> {
impl<'a, T> Iterator for ListIterator<'a, T> {
type Item = &'a T;
fn next(&mut self) -> Option<&'a T> {
match *self.cur {
List::Nil => None,

View File

@ -150,7 +150,9 @@ struct MutDnaSeqs<'a> { s: &'a mut [u8] }
fn mut_dna_seqs<'a>(s: &'a mut [u8]) -> MutDnaSeqs<'a> {
MutDnaSeqs { s: s }
}
impl<'a> Iterator<&'a mut [u8]> for MutDnaSeqs<'a> {
impl<'a> Iterator for MutDnaSeqs<'a> {
type Item = &'a mut [u8];
fn next(&mut self) -> Option<&'a mut [u8]> {
let tmp = std::mem::replace(&mut self.s, &mut []);
let tmp = match memchr(tmp, b'\n') {
@ -229,7 +231,7 @@ unsafe impl<T: 'static> Send for Racy<T> {}
/// The closure `f` is run in parallel with an element of `iter`.
fn parallel<'a, I, T, F>(mut iter: I, f: F)
where T: 'a+Send + Sync,
I: Iterator<&'a mut [T]>,
I: Iterator<Item=&'a mut [T]>,
F: Fn(&mut [T]) + Sync {
use std::mem;
use std::raw::Repr;