mod lend;
mod lend_mut;
mod map;
pub use lend::Lend;
pub use lend_mut::LendMut;
pub use map::Map;
use crate::FromIterator;
#[must_use = "iterators are lazy and do nothing unless consumed"]
pub trait Iterator {
type Item;
async fn next(&mut self) -> Option<Self::Item>;
fn size_hint(&self) -> (usize, Option<usize>) {
(0, None)
}
#[must_use = "iterators do nothing unless iterated over"]
fn map<B, F>(self, f: F) -> Map<Self, F>
where
Self: Sized,
F: FnMut(Self::Item) -> B,
{
Map::new(self, f)
}
#[must_use = "if you really need to exhaust the iterator, consider `.for_each(drop)` instead"]
async fn collect<B: FromIterator<Self::Item>>(self) -> B
where
Self: Sized,
{
let fut = <B as crate::FromIterator<_>>::from_iter(self);
fut.await
}
#[must_use = "iterators do nothing unless iterated over"]
fn lend(self) -> Lend<Self>
where
Self: Sized,
{
Lend::new(self)
}
#[must_use = "iterators do nothing unless iterated over"]
fn lend_mut(self) -> LendMut<Self>
where
Self: Sized,
{
LendMut::new(self)
}
}