objc

source of std::iterable

1// The iteration interfaces driving `for` loops.2//3// Both are lang items (LANGUAGE_SPEC.md section 6.1a) at the canonical4// paths std::iterable::Iterable and std::iterable::Iterator. Fixed5// arrays, slices, heap arrays, and ranges are for-compatible natively6// (section 5.3) and take no marker; a custom type becomes a `for`7// subject by conforming to Iterable, whose `iterator` yields a cursor8// conforming to Iterator. Fully instantiated, they also form interface9// objects (`it: &var Iterator<u64>`) dispatching to a concrete cursor10// unknown until runtime (section 6.2).1112import std::option;1314// The cursor: `next` advances and yields a reference to the next15// element in place, or `None` when exhausted.16exp interface Iterator<T> {17    fn next(self: &var) -> Option<&T>;18}1920// The container: `iterator` yields a fresh cursor by value. Each21// conforming type binds `It` to its concrete cursor type.22exp interface Iterable<T, It: Iterator<T>> {23    fn iterator(self: &) -> It;24}