FlowRunOps

ox.flow.FlowRunOps
trait FlowRunOps[+T]

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Flow[T]
Self type
Flow[T]

Members list

Value members

Concrete methods

def runDrain(): Unit

Ignores all elements emitted by the flow. Blocks until the flow completes.

Ignores all elements emitted by the flow. Blocks until the flow completes.

Attributes

def runFold[U](zero: U)(f: (U, T) => U): U

Uses zero as the current value and applies function f on it and a value emitted by this flow. The returned value is used as the next current value and f is applied again with the next value emitted by the flow. The operation is repeated until the flow emits all elements.

Uses zero as the current value and applies function f on it and a value emitted by this flow. The returned value is used as the next current value and f is applied again with the next value emitted by the flow. The operation is repeated until the flow emits all elements.

Value parameters

f

A binary function (a function that takes two arguments) that is applied to the current value and value emitted by the flow.

zero

An initial value to be used as the first argument to function f call.

Attributes

Returns

Combined value retrieved from running function f on all flow elements in a cumulative manner where result of the previous call is used as an input value to the next.

def runForeach(sink: T => Unit): Unit

Invokes the given function for each emitted element. Blocks until the flow completes.

Invokes the given function for each emitted element. Blocks until the flow completes.

Attributes

def runLast(): T

Returns the last element emitted by this flow, or throws NoSuchElementException when the flow emits no elements (is empty).

Returns the last element emitted by this flow, or throws NoSuchElementException when the flow emits no elements (is empty).

Attributes

Throws
NoSuchElementException

When this flow is empty.

def runLastOption(): Option[T]

Returns the last element emitted by this flow, wrapped in Some, or None when this source is empty.

Returns the last element emitted by this flow, wrapped in Some, or None when this source is empty.

Attributes

def runPipeToSink(sink: Sink[T], propagateDone: Boolean): Unit

Passes each element emitted by this flow to the given sink. Blocks until the flow completes.

Passes each element emitted by this flow to the given sink. Blocks until the flow completes.

Errors are always propagated to the provided sink. Successful flow completion is propagated when propagateDone is set to true.

Fatal errors are rethrown.

Attributes

def runReduce[U >: T](f: (U, U) => U): U

Applies function f on the first and the following (if available) elements emitted by this flow. The returned value is used as the next current value and f is applied again with the next value emitted by this source. The operation is repeated until this flow emits all elements. This is similar operation to fold but it uses the first emitted element as zero.

Applies function f on the first and the following (if available) elements emitted by this flow. The returned value is used as the next current value and f is applied again with the next value emitted by this source. The operation is repeated until this flow emits all elements. This is similar operation to fold but it uses the first emitted element as zero.

Value parameters

f

A binary function (a function that takes two arguments) that is applied to the current and next values emitted by this flow.

Attributes

Returns

Combined value retrieved from running function f on all flow elements in a cumulative manner where result of the previous call is used as an input value to the next.

Throws
NoSuchElementException

When this flow is empty.

def runTakeLast(n: Int): List[T]

Returns the list of up to n last elements emitted by this flow. Less than n elements is returned when this flow emits less elements than requested. List.empty is returned when takeLast is called on an empty flow.

Returns the list of up to n last elements emitted by this flow. Less than n elements is returned when this flow emits less elements than requested. List.empty is returned when takeLast is called on an empty flow.

Value parameters

n

Number of elements to be taken from the end of this flow. It is expected that n >= 0.

Attributes

Returns

A list of up to n last elements from this flow.

The flow is run in the background, and each emitted element is sent to a newly created channel, which is then returned as the result of this method.

The flow is run in the background, and each emitted element is sent to a newly created channel, which is then returned as the result of this method.

Must be run within a concurrency scope as a fork is created to run the flow. The size of the buffer is determined by the BufferCapacity that is in scope.

Attributes

def runToEmit(emit: FlowEmit[T]): Unit

Invokes the provided FlowEmit fo reach emitted element. Blocks until the flow completes.

Invokes the provided FlowEmit fo reach emitted element. Blocks until the flow completes.

Attributes

def runToList(): List[T]

Accumulates all elements emitted by this flow into a list. Blocks until the flow completes.

Accumulates all elements emitted by this flow into a list. Blocks until the flow completes.

Attributes