std: fix fallout
This commit is contained in:
@@ -504,7 +504,9 @@ pub struct CChars<'a> {
|
|||||||
marker: marker::ContravariantLifetime<'a>,
|
marker: marker::ContravariantLifetime<'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Iterator<libc::c_char> for CChars<'a> {
|
impl<'a> Iterator for CChars<'a> {
|
||||||
|
type Item = libc::c_char;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<libc::c_char> {
|
fn next(&mut self) -> Option<libc::c_char> {
|
||||||
let ch = unsafe { *self.ptr };
|
let ch = unsafe { *self.ptr };
|
||||||
if ch == 0 {
|
if ch == 0 {
|
||||||
|
|||||||
@@ -1423,37 +1423,49 @@ enum VacantEntryState<K, V, M> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[stable]
|
#[stable]
|
||||||
impl<'a, K, V> Iterator<(&'a K, &'a V)> for Iter<'a, K, V> {
|
impl<'a, K, V> Iterator for Iter<'a, K, V> {
|
||||||
|
type Item = (&'a K, &'a V);
|
||||||
|
|
||||||
#[inline] fn next(&mut self) -> Option<(&'a K, &'a V)> { self.inner.next() }
|
#[inline] fn next(&mut self) -> Option<(&'a K, &'a V)> { self.inner.next() }
|
||||||
#[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
|
#[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[stable]
|
#[stable]
|
||||||
impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for IterMut<'a, K, V> {
|
impl<'a, K, V> Iterator for IterMut<'a, K, V> {
|
||||||
|
type Item = (&'a K, &'a mut V);
|
||||||
|
|
||||||
#[inline] fn next(&mut self) -> Option<(&'a K, &'a mut V)> { self.inner.next() }
|
#[inline] fn next(&mut self) -> Option<(&'a K, &'a mut V)> { self.inner.next() }
|
||||||
#[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
|
#[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[stable]
|
#[stable]
|
||||||
impl<K, V> Iterator<(K, V)> for IntoIter<K, V> {
|
impl<K, V> Iterator for IntoIter<K, V> {
|
||||||
|
type Item = (K, V);
|
||||||
|
|
||||||
#[inline] fn next(&mut self) -> Option<(K, V)> { self.inner.next() }
|
#[inline] fn next(&mut self) -> Option<(K, V)> { self.inner.next() }
|
||||||
#[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
|
#[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[stable]
|
#[stable]
|
||||||
impl<'a, K, V> Iterator<&'a K> for Keys<'a, K, V> {
|
impl<'a, K, V> Iterator for Keys<'a, K, V> {
|
||||||
|
type Item = &'a K;
|
||||||
|
|
||||||
#[inline] fn next(&mut self) -> Option<(&'a K)> { self.inner.next() }
|
#[inline] fn next(&mut self) -> Option<(&'a K)> { self.inner.next() }
|
||||||
#[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
|
#[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[stable]
|
#[stable]
|
||||||
impl<'a, K, V> Iterator<&'a V> for Values<'a, K, V> {
|
impl<'a, K, V> Iterator for Values<'a, K, V> {
|
||||||
|
type Item = &'a V;
|
||||||
|
|
||||||
#[inline] fn next(&mut self) -> Option<(&'a V)> { self.inner.next() }
|
#[inline] fn next(&mut self) -> Option<(&'a V)> { self.inner.next() }
|
||||||
#[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
|
#[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[stable]
|
#[stable]
|
||||||
impl<'a, K: 'a, V: 'a> Iterator<(K, V)> for Drain<'a, K, V> {
|
impl<'a, K: 'a, V: 'a> Iterator for Drain<'a, K, V> {
|
||||||
|
type Item = (K, V);
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn next(&mut self) -> Option<(K, V)> {
|
fn next(&mut self) -> Option<(K, V)> {
|
||||||
self.inner.next()
|
self.inner.next()
|
||||||
@@ -1511,7 +1523,7 @@ impl<'a, K, V> VacantEntry<'a, K, V> {
|
|||||||
|
|
||||||
#[stable]
|
#[stable]
|
||||||
impl<K: Eq + Hash<S>, V, S, H: Hasher<S> + Default> FromIterator<(K, V)> for HashMap<K, V, H> {
|
impl<K: Eq + Hash<S>, V, S, H: Hasher<S> + Default> FromIterator<(K, V)> for HashMap<K, V, H> {
|
||||||
fn from_iter<T: Iterator<(K, V)>>(iter: T) -> HashMap<K, V, H> {
|
fn from_iter<T: Iterator<Item=(K, V)>>(iter: T) -> HashMap<K, V, H> {
|
||||||
let lower = iter.size_hint().0;
|
let lower = iter.size_hint().0;
|
||||||
let mut map = HashMap::with_capacity_and_hasher(lower, Default::default());
|
let mut map = HashMap::with_capacity_and_hasher(lower, Default::default());
|
||||||
map.extend(iter);
|
map.extend(iter);
|
||||||
@@ -1521,7 +1533,7 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S> + Default> FromIterator<(K, V)> for Has
|
|||||||
|
|
||||||
#[stable]
|
#[stable]
|
||||||
impl<K: Eq + Hash<S>, V, S, H: Hasher<S> + Default> Extend<(K, V)> for HashMap<K, V, H> {
|
impl<K: Eq + Hash<S>, V, S, H: Hasher<S> + Default> Extend<(K, V)> for HashMap<K, V, H> {
|
||||||
fn extend<T: Iterator<(K, V)>>(&mut self, mut iter: T) {
|
fn extend<T: Iterator<Item=(K, V)>>(&mut self, mut iter: T) {
|
||||||
for (k, v) in iter {
|
for (k, v) in iter {
|
||||||
self.insert(k, v);
|
self.insert(k, v);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -603,7 +603,7 @@ impl<T: Eq + Hash<S> + fmt::Show, S, H: Hasher<S>> fmt::Show for HashSet<T, H> {
|
|||||||
|
|
||||||
#[stable]
|
#[stable]
|
||||||
impl<T: Eq + Hash<S>, S, H: Hasher<S> + Default> FromIterator<T> for HashSet<T, H> {
|
impl<T: Eq + Hash<S>, S, H: Hasher<S> + Default> FromIterator<T> for HashSet<T, H> {
|
||||||
fn from_iter<I: Iterator<T>>(iter: I) -> HashSet<T, H> {
|
fn from_iter<I: Iterator<Item=T>>(iter: I) -> HashSet<T, H> {
|
||||||
let lower = iter.size_hint().0;
|
let lower = iter.size_hint().0;
|
||||||
let mut set = HashSet::with_capacity_and_hasher(lower, Default::default());
|
let mut set = HashSet::with_capacity_and_hasher(lower, Default::default());
|
||||||
set.extend(iter);
|
set.extend(iter);
|
||||||
@@ -613,7 +613,7 @@ impl<T: Eq + Hash<S>, S, H: Hasher<S> + Default> FromIterator<T> for HashSet<T,
|
|||||||
|
|
||||||
#[stable]
|
#[stable]
|
||||||
impl<T: Eq + Hash<S>, S, H: Hasher<S> + Default> Extend<T> for HashSet<T, H> {
|
impl<T: Eq + Hash<S>, S, H: Hasher<S> + Default> Extend<T> for HashSet<T, H> {
|
||||||
fn extend<I: Iterator<T>>(&mut self, mut iter: I) {
|
fn extend<I: Iterator<Item=T>>(&mut self, mut iter: I) {
|
||||||
for k in iter {
|
for k in iter {
|
||||||
self.insert(k);
|
self.insert(k);
|
||||||
}
|
}
|
||||||
@@ -789,27 +789,35 @@ pub struct Union<'a, T: 'a, H: 'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[stable]
|
#[stable]
|
||||||
impl<'a, K> Iterator<&'a K> for Iter<'a, K> {
|
impl<'a, K> Iterator for Iter<'a, K> {
|
||||||
|
type Item = &'a K;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<&'a K> { self.iter.next() }
|
fn next(&mut self) -> Option<&'a K> { self.iter.next() }
|
||||||
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
|
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[stable]
|
#[stable]
|
||||||
impl<K> Iterator<K> for IntoIter<K> {
|
impl<K> Iterator for IntoIter<K> {
|
||||||
|
type Item = K;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<K> { self.iter.next() }
|
fn next(&mut self) -> Option<K> { self.iter.next() }
|
||||||
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
|
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[stable]
|
#[stable]
|
||||||
impl<'a, K: 'a> Iterator<K> for Drain<'a, K> {
|
impl<'a, K: 'a> Iterator for Drain<'a, K> {
|
||||||
|
type Item = K;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<K> { self.iter.next() }
|
fn next(&mut self) -> Option<K> { self.iter.next() }
|
||||||
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
|
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[stable]
|
#[stable]
|
||||||
impl<'a, T, S, H> Iterator<&'a T> for Intersection<'a, T, H>
|
impl<'a, T, S, H> Iterator for Intersection<'a, T, H>
|
||||||
where T: Eq + Hash<S>, H: Hasher<S>
|
where T: Eq + Hash<S>, H: Hasher<S>
|
||||||
{
|
{
|
||||||
|
type Item = &'a T;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<&'a T> {
|
fn next(&mut self) -> Option<&'a T> {
|
||||||
loop {
|
loop {
|
||||||
match self.iter.next() {
|
match self.iter.next() {
|
||||||
@@ -828,9 +836,11 @@ impl<'a, T, S, H> Iterator<&'a T> for Intersection<'a, T, H>
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[stable]
|
#[stable]
|
||||||
impl<'a, T, S, H> Iterator<&'a T> for Difference<'a, T, H>
|
impl<'a, T, S, H> Iterator for Difference<'a, T, H>
|
||||||
where T: Eq + Hash<S>, H: Hasher<S>
|
where T: Eq + Hash<S>, H: Hasher<S>
|
||||||
{
|
{
|
||||||
|
type Item = &'a T;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<&'a T> {
|
fn next(&mut self) -> Option<&'a T> {
|
||||||
loop {
|
loop {
|
||||||
match self.iter.next() {
|
match self.iter.next() {
|
||||||
@@ -849,17 +859,21 @@ impl<'a, T, S, H> Iterator<&'a T> for Difference<'a, T, H>
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[stable]
|
#[stable]
|
||||||
impl<'a, T, S, H> Iterator<&'a T> for SymmetricDifference<'a, T, H>
|
impl<'a, T, S, H> Iterator for SymmetricDifference<'a, T, H>
|
||||||
where T: Eq + Hash<S>, H: Hasher<S>
|
where T: Eq + Hash<S>, H: Hasher<S>
|
||||||
{
|
{
|
||||||
|
type Item = &'a T;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<&'a T> { self.iter.next() }
|
fn next(&mut self) -> Option<&'a T> { self.iter.next() }
|
||||||
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
|
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[stable]
|
#[stable]
|
||||||
impl<'a, T, S, H> Iterator<&'a T> for Union<'a, T, H>
|
impl<'a, T, S, H> Iterator for Union<'a, T, H>
|
||||||
where T: Eq + Hash<S>, H: Hasher<S>
|
where T: Eq + Hash<S>, H: Hasher<S>
|
||||||
{
|
{
|
||||||
|
type Item = &'a T;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<&'a T> { self.iter.next() }
|
fn next(&mut self) -> Option<&'a T> { self.iter.next() }
|
||||||
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
|
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -730,7 +730,9 @@ impl<'a, K, V> Clone for RawBuckets<'a, K, V> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl<'a, K, V> Iterator<RawBucket<K, V>> for RawBuckets<'a, K, V> {
|
impl<'a, K, V> Iterator for RawBuckets<'a, K, V> {
|
||||||
|
type Item = RawBucket<K, V>;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<RawBucket<K, V>> {
|
fn next(&mut self) -> Option<RawBucket<K, V>> {
|
||||||
while self.raw.hash != self.hashes_end {
|
while self.raw.hash != self.hashes_end {
|
||||||
unsafe {
|
unsafe {
|
||||||
@@ -757,7 +759,9 @@ struct RevMoveBuckets<'a, K, V> {
|
|||||||
marker: marker::ContravariantLifetime<'a>,
|
marker: marker::ContravariantLifetime<'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, K, V> Iterator<(K, V)> for RevMoveBuckets<'a, K, V> {
|
impl<'a, K, V> Iterator for RevMoveBuckets<'a, K, V> {
|
||||||
|
type Item = (K, V);
|
||||||
|
|
||||||
fn next(&mut self) -> Option<(K, V)> {
|
fn next(&mut self) -> Option<(K, V)> {
|
||||||
if self.elems_left == 0 {
|
if self.elems_left == 0 {
|
||||||
return None;
|
return None;
|
||||||
@@ -816,7 +820,9 @@ pub struct Drain<'a, K: 'a, V: 'a> {
|
|||||||
iter: RawBuckets<'static, K, V>,
|
iter: RawBuckets<'static, K, V>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, K, V> Iterator<(&'a K, &'a V)> for Iter<'a, K, V> {
|
impl<'a, K, V> Iterator for Iter<'a, K, V> {
|
||||||
|
type Item = (&'a K, &'a V);
|
||||||
|
|
||||||
fn next(&mut self) -> Option<(&'a K, &'a V)> {
|
fn next(&mut self) -> Option<(&'a K, &'a V)> {
|
||||||
self.iter.next().map(|bucket| {
|
self.iter.next().map(|bucket| {
|
||||||
self.elems_left -= 1;
|
self.elems_left -= 1;
|
||||||
@@ -832,7 +838,9 @@ impl<'a, K, V> Iterator<(&'a K, &'a V)> for Iter<'a, K, V> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for IterMut<'a, K, V> {
|
impl<'a, K, V> Iterator for IterMut<'a, K, V> {
|
||||||
|
type Item = (&'a K, &'a mut V);
|
||||||
|
|
||||||
fn next(&mut self) -> Option<(&'a K, &'a mut V)> {
|
fn next(&mut self) -> Option<(&'a K, &'a mut V)> {
|
||||||
self.iter.next().map(|bucket| {
|
self.iter.next().map(|bucket| {
|
||||||
self.elems_left -= 1;
|
self.elems_left -= 1;
|
||||||
@@ -848,7 +856,9 @@ impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for IterMut<'a, K, V> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<K, V> Iterator<(SafeHash, K, V)> for IntoIter<K, V> {
|
impl<K, V> Iterator for IntoIter<K, V> {
|
||||||
|
type Item = (SafeHash, K, V);
|
||||||
|
|
||||||
fn next(&mut self) -> Option<(SafeHash, K, V)> {
|
fn next(&mut self) -> Option<(SafeHash, K, V)> {
|
||||||
self.iter.next().map(|bucket| {
|
self.iter.next().map(|bucket| {
|
||||||
self.table.size -= 1;
|
self.table.size -= 1;
|
||||||
@@ -870,7 +880,9 @@ impl<K, V> Iterator<(SafeHash, K, V)> for IntoIter<K, V> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, K: 'a, V: 'a> Iterator<(SafeHash, K, V)> for Drain<'a, K, V> {
|
impl<'a, K: 'a, V: 'a> Iterator for Drain<'a, K, V> {
|
||||||
|
type Item = (SafeHash, K, V);
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn next(&mut self) -> Option<(SafeHash, K, V)> {
|
fn next(&mut self) -> Option<(SafeHash, K, V)> {
|
||||||
self.iter.next().map(|bucket| {
|
self.iter.next().map(|bucket| {
|
||||||
|
|||||||
@@ -52,7 +52,9 @@ impl<'r, R: Reader> Bytes<'r, R> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'r, R: Reader> Iterator<IoResult<u8>> for Bytes<'r, R> {
|
impl<'r, R: Reader> Iterator for Bytes<'r, R> {
|
||||||
|
type Item = IoResult<u8>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn next(&mut self) -> Option<IoResult<u8>> {
|
fn next(&mut self) -> Option<IoResult<u8>> {
|
||||||
match self.reader.read_byte() {
|
match self.reader.read_byte() {
|
||||||
|
|||||||
@@ -563,7 +563,9 @@ pub struct Directories {
|
|||||||
stack: Vec<Path>,
|
stack: Vec<Path>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Iterator<Path> for Directories {
|
impl Iterator for Directories {
|
||||||
|
type Item = Path;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<Path> {
|
fn next(&mut self) -> Option<Path> {
|
||||||
match self.stack.pop() {
|
match self.stack.pop() {
|
||||||
Some(path) => {
|
Some(path) => {
|
||||||
|
|||||||
@@ -1371,7 +1371,9 @@ pub struct Lines<'r, T:'r> {
|
|||||||
buffer: &'r mut T,
|
buffer: &'r mut T,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'r, T: Buffer> Iterator<IoResult<String>> for Lines<'r, T> {
|
impl<'r, T: Buffer> Iterator for Lines<'r, T> {
|
||||||
|
type Item = IoResult<String>;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<IoResult<String>> {
|
fn next(&mut self) -> Option<IoResult<String>> {
|
||||||
match self.buffer.read_line() {
|
match self.buffer.read_line() {
|
||||||
Ok(x) => Some(Ok(x)),
|
Ok(x) => Some(Ok(x)),
|
||||||
@@ -1398,7 +1400,9 @@ pub struct Chars<'r, T:'r> {
|
|||||||
buffer: &'r mut T
|
buffer: &'r mut T
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'r, T: Buffer> Iterator<IoResult<char>> for Chars<'r, T> {
|
impl<'r, T: Buffer> Iterator for Chars<'r, T> {
|
||||||
|
type Item = IoResult<char>;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<IoResult<char>> {
|
fn next(&mut self) -> Option<IoResult<char>> {
|
||||||
match self.buffer.read_char() {
|
match self.buffer.read_char() {
|
||||||
Ok(x) => Some(Ok(x)),
|
Ok(x) => Some(Ok(x)),
|
||||||
@@ -1649,14 +1653,18 @@ pub struct IncomingConnections<'a, Sized? A:'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(stage0)]
|
#[cfg(stage0)]
|
||||||
impl<'a, T, A: Acceptor<T>> Iterator<IoResult<T>> for IncomingConnections<'a, A> {
|
impl<'a, T, A: Acceptor<T>> Iterator for IncomingConnections<'a, A> {
|
||||||
|
type Item = IoResult<T>;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<IoResult<T>> {
|
fn next(&mut self) -> Option<IoResult<T>> {
|
||||||
Some(self.inc.accept())
|
Some(self.inc.accept())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(stage0))]
|
#[cfg(not(stage0))]
|
||||||
impl<'a, T, Sized? A: Acceptor<T>> Iterator<IoResult<T>> for IncomingConnections<'a, A> {
|
impl<'a, T, Sized? A: Acceptor<T>> Iterator for IncomingConnections<'a, A> {
|
||||||
|
type Item = IoResult<T>;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<IoResult<T>> {
|
fn next(&mut self) -> Option<IoResult<T>> {
|
||||||
Some(self.inc.accept())
|
Some(self.inc.accept())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ pub struct ChainedReader<I, R> {
|
|||||||
cur_reader: Option<R>,
|
cur_reader: Option<R>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<R: Reader, I: Iterator<R>> ChainedReader<I, R> {
|
impl<R: Reader, I: Iterator<Item=R>> ChainedReader<I, R> {
|
||||||
/// Creates a new `ChainedReader`
|
/// Creates a new `ChainedReader`
|
||||||
pub fn new(mut readers: I) -> ChainedReader<I, R> {
|
pub fn new(mut readers: I) -> ChainedReader<I, R> {
|
||||||
let r = readers.next();
|
let r = readers.next();
|
||||||
@@ -177,7 +177,7 @@ impl<R: Reader, I: Iterator<R>> ChainedReader<I, R> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<R: Reader, I: Iterator<R>> Reader for ChainedReader<I, R> {
|
impl<R: Reader, I: Iterator<Item=R>> Reader for ChainedReader<I, R> {
|
||||||
fn read(&mut self, buf: &mut [u8]) -> io::IoResult<uint> {
|
fn read(&mut self, buf: &mut [u8]) -> io::IoResult<uint> {
|
||||||
loop {
|
loop {
|
||||||
let err = match self.cur_reader {
|
let err = match self.cur_reader {
|
||||||
@@ -252,7 +252,7 @@ pub struct IterReader<T> {
|
|||||||
iter: T,
|
iter: T,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Iterator<u8>> IterReader<T> {
|
impl<T: Iterator<Item=u8>> IterReader<T> {
|
||||||
/// Creates a new `IterReader` which will read from the specified
|
/// Creates a new `IterReader` which will read from the specified
|
||||||
/// `Iterator`.
|
/// `Iterator`.
|
||||||
pub fn new(iter: T) -> IterReader<T> {
|
pub fn new(iter: T) -> IterReader<T> {
|
||||||
@@ -260,7 +260,7 @@ impl<T: Iterator<u8>> IterReader<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Iterator<u8>> Reader for IterReader<T> {
|
impl<T: Iterator<Item=u8>> Reader for IterReader<T> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn read(&mut self, buf: &mut [u8]) -> io::IoResult<uint> {
|
fn read(&mut self, buf: &mut [u8]) -> io::IoResult<uint> {
|
||||||
let mut len = 0;
|
let mut len = 0;
|
||||||
|
|||||||
@@ -404,7 +404,7 @@ pub fn random<T: Rand>() -> T {
|
|||||||
/// let sample = sample(&mut rng, range(1i, 100), 5);
|
/// let sample = sample(&mut rng, range(1i, 100), 5);
|
||||||
/// println!("{}", sample);
|
/// println!("{}", sample);
|
||||||
/// ```
|
/// ```
|
||||||
pub fn sample<T, I: Iterator<T>, R: Rng>(rng: &mut R,
|
pub fn sample<T, I: Iterator<Item=T>, R: Rng>(rng: &mut R,
|
||||||
mut iter: I,
|
mut iter: I,
|
||||||
amount: uint) -> Vec<T> {
|
amount: uint) -> Vec<T> {
|
||||||
let mut reservoir: Vec<T> = iter.by_ref().take(amount).collect();
|
let mut reservoir: Vec<T> = iter.by_ref().take(amount).collect();
|
||||||
|
|||||||
@@ -936,7 +936,9 @@ impl<T: Send> select::Packet for Receiver<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[unstable]
|
#[unstable]
|
||||||
impl<'a, T: Send> Iterator<T> for Iter<'a, T> {
|
impl<'a, T: Send> Iterator for Iter<'a, T> {
|
||||||
|
type Item = T;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<T> { self.rx.recv().ok() }
|
fn next(&mut self) -> Option<T> { self.rx.recv().ok() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -319,7 +319,9 @@ impl<'rx, T: Send> Drop for Handle<'rx, T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Iterator<*mut Handle<'static, ()>> for Packets {
|
impl Iterator for Packets {
|
||||||
|
type Item = *mut Handle<'static, ()>;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<*mut Handle<'static, ()>> {
|
fn next(&mut self) -> Option<*mut Handle<'static, ()>> {
|
||||||
if self.cur.is_null() {
|
if self.cur.is_null() {
|
||||||
None
|
None
|
||||||
|
|||||||
Reference in New Issue
Block a user