StreamOps

fs2.interop.flow.syntax$.StreamOps
final implicit class StreamOps[F[_], A](stream: Stream[F, A]) extends AnyVal

Attributes

Source
syntax.scala
Graph
Supertypes
class AnyVal
trait Matchable
class Any

Members list

Value members

Concrete methods

def subscribe(subscriber: Subscriber[A])(implicit F: Async[F]): F[Unit]

Subscribes the provided Subscriber to this stream.

Subscribes the provided Subscriber to this stream.

The returned program will run until all the stream elements were consumed. Cancelling this program will gracefully shutdown the subscription.

Value parameters

subscriber

the Subscriber that will receive the elements of the stream.

Attributes

Source
syntax.scala
def toPublisher(implicit F: Async[F]): Resource[F, Publisher[A]]

Creates a Publisher from a Stream.

Creates a Publisher from a Stream.

The stream is only ran when elements are requested. Closing the Resource means gracefully shutting down all active subscriptions. Thus, no more elements will be published.

Attributes

See also

subscribe for a simpler version that only requires a Subscriber.

Note

This Publisher can be reused for multiple Subscribers, each subscription will re-run the Stream from the beginning.

Source
syntax.scala