AsyncIterator

trait AsyncIterator[F[_], T]

Minimal mutable async stream.

Companion:
object
class Object
trait Matchable
class Any
class AsyncListIterator[F, T]

Value members

Abstract methods

def next: F[Option[T]]

return the next element of stream in option or None if stream is finished.

return the next element of stream in option or None if stream is finished.

Concrete methods

def filter(p: T => Boolean): AsyncIterator[F, T]

filter accumulator by p, returning only those values, which as satisficy p.

filter accumulator by p, returning only those values, which as satisficy p.

def filterAsync(p: T => F[Boolean]): AsyncIterator[F, T]

filter accumulator by p, returning only those values, which as satisficy p. Note, that p is applied sequentially

filter accumulator by p, returning only those values, which as satisficy p. Note, that p is applied sequentially

def find(p: T => Boolean): F[Option[T]]

Find first value wich satisficy p

Find first value wich satisficy p

def findAsync(p: T => F[Boolean]): F[Option[T]]
def flatMap[S](f: T => AsyncIterator[F, S]): AsyncIterator[F, S]
def flatMapAsync[S](f: T => F[AsyncIterator[F, S]]): AsyncIterator[F, S]
def flatMapTry[S](f: Try[T] => AsyncIterator[F, S]): AsyncIterator[F, S]
def flatMapTryAsync[S](f: Try[T] => F[AsyncIterator[F, S]]): AsyncIterator[F, S]
def fold[S](s0: S)(f: (S, T) => S): F[S]
def foldAsync[S](s0: S)(f: (S, T) => F[S]): F[S]
def inTry: AsyncIterator[F, Try[T]]

synonym for mapTry(identity)

synonym for mapTry(identity)

def map[S](f: T => S): AsyncIterator[F, S]

return iterator with values mapped by f

return iterator with values mapped by f

def mapAsync[S](f: T => F[S]): AsyncIterator[F, S]

map over async function. Substituted automatically when using await inside async block in map.

map over async function. Substituted automatically when using await inside async block in map.

def mapTry[S](f: Try[T] => S): AsyncIterator[F, S]

map over Try[T], which allows to handle the cases, when next returns a failure. Be carefuel for situation, when failed next have no effect - in this case we will receive the infinite sequence of failuers.

map over Try[T], which allows to handle the cases, when next returns a failure. Be carefuel for situation, when failed next have no effect - in this case we will receive the infinite sequence of failuers.

def mapTryAsync[S](f: Try[T] => F[S]): AsyncIterator[F, S]

async version of mapTry

async version of mapTry

def scan[S](s0: S)(f: (S, T) => S): AsyncIterator[F, S]

Scan the value and output in the resulting iterator cummulative accumulated values. Note, that

Scan the value and output in the resulting iterator cummulative accumulated values. Note, that

  • f should be side effects free, since it can be reapplied in situation, when parallel threads tryng to read the next value
  • s0 and f(s,t) should not be nulls.
def scanAsync[S](s0: S)(f: (S, T) => F[S]): AsyncIterator[F, S]

Scan the value and output in the resulting iterator cummulative accumulated values. Note, that

Scan the value and output in the resulting iterator cummulative accumulated values. Note, that

  • f should be side effects free, since it can be reapplied in situation, when parallel threads tryng to read the next value
  • s0 and f(s,t) should not be nulls.
def take[CC[_]](n: Int)(using Factory[T, CC[T]]): F[CC[T]]
def takeAll[CC[_]](n: Int)(using Factory[T, CC[T]]): F[CC[T]]
def takeList(n: Int): F[List[T]]
def takeTo[B <: Growable[T]](buffer: B, n: Int): F[B]
def takeVector(n: Int): F[Vector[T]]