c

fs2.Stream

InvariantOps

implicit final class InvariantOps[F[_], O] extends AnyVal

A view of Stream that removes the variance from the type parameters. This allows defining syntax in which the type parameters appear in contravariant (i.e. input) position, which would fail to compile if defined as instance methods.

Source
Stream.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. InvariantOps
  2. AnyVal
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new InvariantOps(self: Stream[F, O])

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    Any
  2. final def ##: Int
    Definition Classes
    Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def covary[F2[x] >: F[x]]: Stream[F2, O]

    Lifts this stream to the specified effect type.

    Lifts this stream to the specified effect type.

    Example:
    1. scala> import cats.effect.IO
      scala> Stream(1, 2, 3).covary[IO]
      res0: Stream[IO,Int] = Stream(..)
  6. def getClass(): Class[_ <: AnyVal]
    Definition Classes
    AnyVal → Any
  7. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  8. def observe(p: Pipe[F, O, Nothing])(implicit F: Concurrent[F]): Stream[F, O]

    Synchronously sends values through p.

    Synchronously sends values through p.

    If p fails, then resulting stream will fail. If p halts the evaluation will halt too.

    Note that observe will only output full chunks of O that are known to be successfully processed by p. So if p terminates/fails in the middle of chunk processing, the chunk will not be available in resulting stream.

    Note that if your pipe can be represented by an O => F[Unit], evalTap will provide much greater performance.

    Example:
    1. scala> import cats.effect.IO, cats.effect.unsafe.implicits.global
      scala> Stream(1, 2, 3).covary[IO].observe(_.printlns).map(_ + 1).compile.toVector.unsafeRunSync()
      res0: Vector[Int] = Vector(2, 3, 4)
  9. def observeAsync(maxQueued: Int)(pipe: Pipe[F, O, Nothing])(implicit F: Concurrent[F]): Stream[F, O]

    Attaches to this stream an observer pipe, that pre-inspects the outputs from this stream (the source) before the result stream emits them.

    Attaches to this stream an observer pipe, that pre-inspects the outputs from this stream (the source) before the result stream emits them.

    Outputs from the source are fed to the observer pipe, to build a stream that is run in the background. However, unlike the background method, the observe method binds the mainstream: if the observation stream reaches a stream end, the resulting stream is cut short.

    The resulting stream emits the same outputs as the source (this) stream, in the same order and chunk structure. However, no chunk is emitted by the resulting stream until _after_ the observer pipe is done processing it.

    Any errors raised either from the evaluation of the source stream (this) or from the observer pipe (when applied to source chunks) will cause the termination of the resulting stream, and will be raised from this.

    returns

    A stream that may emit the same outputs as this stream (source), in the same order and chunks, and performs the same effects as the source; but in which every chunk is processed by the pipe.

  10. def observeEither[L, R](left: Pipe[F, L, Nothing], right: Pipe[F, R, Nothing])(implicit F: Concurrent[F], ev: <:<[O, Either[L, R]]): Stream[F, Either[L, R]]

    Observes this stream of Either[L, R] values with two pipes, one that observes left values and another that observes right values.

    Observes this stream of Either[L, R] values with two pipes, one that observes left values and another that observes right values.

    If either of left or right fails, then resulting stream will fail. If either halts the evaluation will halt too.

  11. def pull: ToPull[F, O]

    Gets a projection of this stream that allows converting it to a Pull in a number of ways.

  12. def repeatPull[O2](f: (ToPull[F, O]) => Pull[F, O2, Option[Stream[F, O]]]): Stream[F, O2]

    Repeatedly invokes using, running the resultant Pull each time, halting when a pull returns None instead of Some(nextStream).

  13. def toString(): String
    Definition Classes
    Any

Inherited from AnyVal

Inherited from Any

Ungrouped