View Source Iter.IntoIterable protocol (iterex v0.1.1)

A protocol for converting a value into an iterable.

Required by Iter.from/1 and others.

By default this protocol is implemented for List, Map, MapSet, Range, Date.Range, File.Stream and IO.Stream as well as all iterex's internal types.

Allows the data and the iterable for that data to be separate. It could be as simple as a reference to some external data source and a position marker or it may be more efficient to read data in batches and iterate it. Regardless, most types simply return themselves from this function.

It is important that your into_iterable/1 callback must not actually start iterating, it simply returns a data structure suitable to track the iteration of the underlying data.

Summary

Types

t()

All the types that implement this protocol.

Functions

Convert a value into an iterable.

Types

@type t() :: term()

All the types that implement this protocol.

Functions

@spec into_iterable(t()) :: Iter.Iterable.t()

Convert a value into an iterable.