index.nct
see ./core.nct
see ./defaults.nct
see ./mutable.nct
see ./sources.nct
see ./adapters.nct
pub use /iter/asynchronous.AsyncIterator
pub use /iter/lending.LendingIterator
pub struct MapIter<U, I, F>
pub struct FilterIter<I, F>
pub struct TakeIter<I>
pub struct SkipIter<I>
pub struct ChainIter<L, R>
pub struct Indexed<T> {
pub index: usize
pub item: T
}
pub struct EnumerateIter<I>
pub struct FoldStep<T, U> {
pub accumulator: U
pub item: T
}
pub interface Iterator {
pub type Item
pub method &+self.next(): Self.Item?
pub noalloc default method self.map<U, F>(transform: F): MapIter<U, Self, F> from self | transform where F: &+func(item: Self.Item): U
pub noalloc default method self.filter<F>(predicate: F): FilterIter<Self, F> from self | predicate where F: &+func(&Self.Item): bool
pub noalloc default method self.take(limit: usize): TakeIter<Self>
pub noalloc default method self.skip(amount: usize): SkipIter<Self>
pub noalloc default method self.chain<R>(right: R): ChainIter<Self, R> from self | right where R impl Iterator { .Item = Self.Item }
pub noalloc default method self.enumerate(): EnumerateIter<Self>
pub default method self.count(): usize
pub default method self.last(): Self.Item? from self
pub default method self.find<F>(predicate: F): Self.Item? from self where F: &+func(&Self.Item): bool
pub default method self.any<F>(predicate: F): bool where F: &+func(&Self.Item): bool
pub default method self.all<F>(predicate: F): bool where F: &+func(&Self.Item): bool
pub default method self.contains<T>(expected: &T): bool where Self impl Iterator { .Item = T }, (&T == &T): bool
pub default method self.position<T>(expected: &T): usize? where Self impl Iterator { .Item = T }, (&T == &T): bool
pub default method self.fold<U, F>(
initial: U,
combine: F,
): U from self | initial | combine where F: &+func(step: FoldStep<Self.Item, U>): U
}
pub interface ExactSizeIterator where Self impl Iterator {
pub method &self.remaining_len(): usize
}
instance MapIter<U, I, F> where I impl Iterator, F: &+func(item: I.Item): U {
impl Iterator { .Item = U }
}
instance MapIter<U, I, F> where I impl ExactSizeIterator, F: &+func(item: I.Item): U {
impl ExactSizeIterator
}
instance FilterIter<I, F> where I impl Iterator, F: &+func(&I.Item): bool {
impl Iterator { .Item = I.Item }
}
instance TakeIter<I> where I impl Iterator {
impl Iterator { .Item = I.Item }
}
instance TakeIter<I> where I impl ExactSizeIterator {
impl ExactSizeIterator
}
instance SkipIter<I> where I impl Iterator {
impl Iterator { .Item = I.Item }
}
instance SkipIter<I> where I impl ExactSizeIterator {
impl ExactSizeIterator
}
instance ChainIter<L, R> where L impl Iterator, R impl Iterator { .Item = L.Item } {
impl Iterator { .Item = L.Item }
}
instance EnumerateIter<I> where I impl Iterator {
impl Iterator { .Item = Indexed<I.Item> }
}
instance EnumerateIter<I> where I impl ExactSizeIterator {
impl ExactSizeIterator
}
pub struct EmptyIter<T>
instance EmptyIter<T> {
impl ExactSizeIterator
impl Iterator { .Item = T }
}
pub struct OnceIter<T>
instance OnceIter<T> {
impl ExactSizeIterator
impl Iterator { .Item = T }
}
pub noalloc func empty<T>(): EmptyIter<T>
pub noalloc func once<T>(item: T): OnceIter<T>
pub struct ViewIter<T>
pub struct MutableViewIter<T>
instance MutableViewIter<T> {
impl ExactSizeIterator
impl Iterator { .Item = &+T }
}
construct MutableViewIter<T> {
pub noalloc notrap func from_view(view: &+[T]): Self
}
construct ViewIter<T> {
pub noalloc notrap func from_view(view: &[T]): Self
}
instance ViewIter<T> {
impl ExactSizeIterator
impl Iterator { .Item = &T }
}