baml.iter.Iterable
Implemented by types that can be iterated over.
Signature
interface baml.iter.IterableImplemented by types that can be iterated over.
This is what for (x in xs) asks for: a container implements Iterable and
hands out an iterator. It is Rust's
IntoIterator,
and plays the part of Python's __iter__ or JavaScript's
[Symbol.iterator]. Because baml.iter.Iterator in turn requires
Iterable, an iterator is itself iterable and can be passed anywhere an
Iterable is wanted.
T[] and string implement it at the bottom of this file.
Source:<builtin>/baml/ns_iter/iter.bamlbytes 1154–2068
Associated types
type Item
type Error
= neverRequired instance methods
iter
(Creates an iterator over the value.
The return type is the interface rather than a concrete class, so the
implementor picks its own iterator type: T[] returns a
baml.iter.ArrayIterator, while every iterator in this file returns
self.
That last part is worth remembering. Calling iter on something that is
already an iterator hands back the same, shared iterator. It does not
rewind a partly-consumed one, and two callers will pull from the same
cursor.
Related definitions
baml.csv.Readerbaml.csv.Rowsbaml.iter.ArrayIteratorbaml.iter.Chainbaml.iter.Filterbaml.iter.FilterMapbaml.iter.FlatMapbaml.iter.Flattenbaml.iter.Iteratorbaml.iter.Mapbaml.iter.Peekablebaml.iter.Rangebaml.iter.Repeatbaml.iter.Skipbaml.iter.SkipWhilebaml.iter.StepBybaml.iter.Takebaml.iter.TakeWhilebaml.sys.ReadPipeLinesbaml.csv.Readerbaml.csv.Rowsbaml.iter.ArrayIteratorbaml.iter.Chainbaml.iter.Filterbaml.iter.FilterMapbaml.iter.FlatMapbaml.iter.Flattenbaml.iter.Mapbaml.iter.Peekablebaml.iter.Rangebaml.iter.Repeatbaml.iter.Skipbaml.iter.SkipWhilebaml.iter.StepBybaml.iter.Takebaml.iter.TakeWhilebaml.sys.ReadPipeLinesbaml.Stringbaml.Array