Stateless

io.dylemma.spac.Transformer.Stateless
trait Stateless[-In, +Out] extends Transformer[In, Out], Handler[In, Out]

A stateless transformer acts as its own handler

Type parameters

In

The incoming event type

Out

The outgoing event type

Attributes

Graph
Supertypes
trait Handler[In, Out]
trait Transformer[In, Out]
class Object
trait Matchable
class Any
Known subtypes
class TransformerCollect[In, Out]
class TransformerFilter[In]
class TransformerMap[A, B]
class TransformerMapFlatten[In, Out]
class TransformerTap[In]
Show all

Members list

Value members

Concrete methods

def newHandler: Stateless.this.type

Transformer's main abstract method; constructs a new Handler representing this transformer's logic. Transformers are expected to be immutable, but Handlers may be internally-mutable.

Transformer's main abstract method; constructs a new Handler representing this transformer's logic. Transformers are expected to be immutable, but Handlers may be internally-mutable.

Attributes

Inherited methods

def asTopLevelHandler(caller: SpacTraceElement): Handler[In, Out]

Wraps this handler as a "top level" handler, which will inject a SpacTraceElement (representing the current input or the "EOF" signal) to any exception is thrown by this handler when calling its step or finish methods.

Wraps this handler as a "top level" handler, which will inject a SpacTraceElement (representing the current input or the "EOF" signal) to any exception is thrown by this handler when calling its step or finish methods.

Used internally by Transformers transform and toPipe methods.

Attributes

Inherited from:
Handler
def bubbleUp(err: Throwable): Nothing

In response to an error thrown and caught from a downstream consumer, this handler may modify the exception on its way back upstream. Used by the "spac frame" transformer.

In response to an error thrown and caught from a downstream consumer, this handler may modify the exception on its way back upstream. Used by the "spac frame" transformer.

Value parameters

err

An error thrown by some downstream handler

Attributes

Returns

Nothing, because this method must always throw something

Inherited from:
Handler
def cast[Out2](implicit ev: Out <:< Out2): Transformer[In, Out2]

Returns this transformer, but with a different view of the Out type. The Out <:< Out2 implicit evidence is used to make sure the asInstanceOf cast is safe. This is mostly useful when you know you have a transformer that yields a tuple or some kind of type constructor.

Returns this transformer, but with a different view of the Out type. The Out <:< Out2 implicit evidence is used to make sure the asInstanceOf cast is safe. This is mostly useful when you know you have a transformer that yields a tuple or some kind of type constructor.

Attributes

Inherited from:
Transformer
def collect[Out2](pf: PartialFunction[Out, Out2]): Transformer[In, Out2]

Creates a new transformer which filters and maps the outputs from this transformer

Creates a new transformer which filters and maps the outputs from this transformer

Type parameters

Out2

Result type of the pf

Value parameters

pf

Partial function responsible for the filtering and mapping of outputs from this transformer

Attributes

Returns

The filteried and mapped transformer

Inherited from:
Transformer
def drain: Parser[In, Unit]

Convenience for this into Parser.drain

Convenience for this into Parser.drain

Attributes

Inherited from:
Transformer
def filter(predicate: Out => Boolean): Transformer[In, Out]

Creates a new transformer which filters the outputs from this transformer.

Creates a new transformer which filters the outputs from this transformer.

Value parameters

predicate

A function which decides whether an output from this transformer should be emitted from the returned transformer. true means emit, false means skip.

Attributes

Returns

The filtered transformer

Inherited from:
Transformer
def finish(out: HandlerWrite[Out]): Unit

In response to the end of the stream of incoming values, this handler may output any number of final output values via the provided HandlerWrite. The expectation is that a Handler's finish method will only ever be called once before that Handler is discarded, with the exception of Stateless Transformers, which act as their own Handlers and will be reused.

In response to the end of the stream of incoming values, this handler may output any number of final output values via the provided HandlerWrite. The expectation is that a Handler's finish method will only ever be called once before that Handler is discarded, with the exception of Stateless Transformers, which act as their own Handlers and will be reused.

Value parameters

out

The downstream receiver of output values

Attributes

Inherited from:
Handler
def into[Out2](parser: Parser[Out, Out2]): Parser[In, Out2]

Attach this transformer to a parser, creating a new parser that encapsulates the pair. Values emitted from this transformer will be passed as inputs to the parser, and the resulting output from the parser will be yielded as output by the combined parser.

Attach this transformer to a parser, creating a new parser that encapsulates the pair. Values emitted from this transformer will be passed as inputs to the parser, and the resulting output from the parser will be yielded as output by the combined parser.

Attributes

Inherited from:
Transformer
def map[Out2](f: Out => Out2): Transformer[In, Out2]

Creates a new transformer which applies the transformation function f to each of this transformer's outputs.

Creates a new transformer which applies the transformation function f to each of this transformer's outputs.

Type parameters

Out2

The transformation output type

Value parameters

f

A transformation function

Attributes

Returns

The mapped transformer

Inherited from:
Transformer
def mapFlatten[Out2](f: Out => Iterable[Out2]): Transformer[In, Out2]

Creates a new transformer which transforms the outputs of this transformer via the given function f, emitting each individual value from the output of that function in order before continuing.

Creates a new transformer which transforms the outputs of this transformer via the given function f, emitting each individual value from the output of that function in order before continuing.

Type parameters

Out2

The transformed output type

Value parameters

f

A function that transforms outputs from this transformer into a collection of other outputs

Attributes

Returns

A new transformer which emits any number of transformed outputs based on outputs from this transformer

Inherited from:
Transformer
def merge[In2 <: In, Out2 >: Out](that: Transformer[In2, Out2]): Transformer[In2, Out2]

Like mergeEither, but when both sides have a common output type. This is a less-roundabout way of doing .mergeEither(right).map(_.merge). The same order-of-operations rules apply as with mergeEither, where this transformer "goes first" for each input.

Like mergeEither, but when both sides have a common output type. This is a less-roundabout way of doing .mergeEither(right).map(_.merge). The same order-of-operations rules apply as with mergeEither, where this transformer "goes first" for each input.

Type parameters

In2

Contravariance-friendly version of In

Out2

Common output type between this and that

Value parameters

that

Another transformer

Attributes

Returns

The merged transformer

Inherited from:
Transformer
def mergeEither[In2 <: In, Out2](right: Transformer[In2, Out2]): Transformer[In2, Either[Out, Out2]]

Creates a new transformer which sends inputs to both this transformer and the right transformer. Whenever either this or right emit a value, that value will be emitted from the returned transformer, wrapped as a Left or Right depending on which underlying transformer emitted it. For each individual input, the resulting values emitted by this transformer will be emitted before the resulting values emitted by the right transformer.

Creates a new transformer which sends inputs to both this transformer and the right transformer. Whenever either this or right emit a value, that value will be emitted from the returned transformer, wrapped as a Left or Right depending on which underlying transformer emitted it. For each individual input, the resulting values emitted by this transformer will be emitted before the resulting values emitted by the right transformer.

Type parameters

In2

Contravariance-friendly version of In

Out2

The output type of the right transformer

Value parameters

right

Another transformer

Attributes

Returns

The merged transformer

Inherited from:
Transformer
def parseAsFold[Out2](init: Out2)(f: (Out2, Out) => Out2): Parser[In, Out2]

Convenience for this into Parser.fold(init)(f)

Convenience for this into Parser.fold(init)(f)

Attributes

Inherited from:
Transformer
def parseFirstOpt: Parser[In, Option[Out]]

Convenience for this into Parser.firstOpt

Convenience for this into Parser.firstOpt

Attributes

Inherited from:
Transformer
def parseTap(f: Out => Unit): Parser[In, Unit]

Convenience for this into Parser.tap(f)

Convenience for this into Parser.tap(f)

Attributes

Inherited from:
Transformer
def parseToList: Parser[In, List[Out]]

Convenience for this into Parser.toList

Convenience for this into Parser.toList

Attributes

Inherited from:
Transformer
def push(in: In, out: HandlerWrite[Out]): Signal

In response to some input value in, this handler may output any number of output values via the provided HandlerWrite, possibly change its internal state, and signal to the upstream caller whether it wants to continue or stop receiving new inputs. Upstream handlers SHOULD avoid making more calls to this handler's push after it returns Signal.Stop.

In response to some input value in, this handler may output any number of output values via the provided HandlerWrite, possibly change its internal state, and signal to the upstream caller whether it wants to continue or stop receiving new inputs. Upstream handlers SHOULD avoid making more calls to this handler's push after it returns Signal.Stop.

Value parameters

in

An input value

out

The downstream receiver of output values

Attributes

Returns

A "signal" indicating whether this handler wants to continue receiving inputs afterward

Inherited from:
Handler
def pushMany(ins: Iterator[In], out: HandlerWrite[Out]): Signal

Convenience for calling push multiple times, aborting early if the signal becomes Stop in response to any one push.

Convenience for calling push multiple times, aborting early if the signal becomes Stop in response to any one push.

Value parameters

ins

An iterator which produces input values to push into this handler

out

The downstream receiver of output values

Attributes

Returns

A "signal" indicating whether this handler wants to continue receiving inputs afterward

Inherited from:
Handler
def scan[Out2](init: Out2)(op: (Out2, Out) => Out2): Transformer[In, Out2]

Creates a new transformer which folds outputs from this transformer into a "state" which is emitted each time.

Creates a new transformer which folds outputs from this transformer into a "state" which is emitted each time.

Type parameters

Out2

The type of the scan "state"

Value parameters

init

The initial "state"

op

State update function; this is called for each Out emitted by this transformer, and the result is emitted by the combined transformer in addition to becoming the next "state"

Attributes

Returns

The new transformer

Inherited from:
Transformer
def through[Out2](next: Transformer[Out, Out2]): Transformer[In, Out2]

Attach this transformer to the next transformer, creating a single transformer that encapsulates the pair. Values emitted from this transformer will be passed as inputs to the next transformer, and the resulting outputs from the next transformer are emitted as outputs from the combined transformer.

Attach this transformer to the next transformer, creating a single transformer that encapsulates the pair. Values emitted from this transformer will be passed as inputs to the next transformer, and the resulting outputs from the next transformer are emitted as outputs from the combined transformer.

Attributes

Inherited from:
Transformer
def transform(source: Source[In])(implicit pos: CallerPos): Source[Out]

Applies this transformer's logic to a Source, returning a new Source which yields values emitted by this transformer when run on the underlying iterator.

Applies this transformer's logic to a Source, returning a new Source which yields values emitted by this transformer when run on the underlying iterator.

Value parameters

pos

Captures the call site for the top level SpacTraceElement

source

A Source

Attributes

Returns

A wrapped version of source, transformed via this transformer

Inherited from:
Transformer
def transform(itr: Iterator[In])(implicit pos: CallerPos): Iterator[Out]

Applies this transformer's logic to an iterator, returning a new Iterator which yields values emitted by this transformer when run on the underlying itr.

Applies this transformer's logic to an iterator, returning a new Iterator which yields values emitted by this transformer when run on the underlying itr.

Value parameters

itr

An iterator

Attributes

Returns

A wrapped version of itr, transformed via this transformer

Inherited from:
Transformer
def upcast[In2 <: In, Out2 >: Out]: Transformer[In2, Out2]

Returns this transformer, but with less restricted In / Out types.

Returns this transformer, but with less restricted In / Out types.

Type parameters

In2

A subtype of In

Out2

A supertype of Out

Attributes

Returns

This transformer (not a copy, it's actually literally this)

Inherited from:
Transformer
def withFilter(predicate: Out => Boolean): Transformer[In, Out]

Alias for filter, used under the hood by for-comprehensions

Alias for filter, used under the hood by for-comprehensions

Value parameters

predicate

The filtering function

Attributes

Returns

The filtered transformer

Inherited from:
Transformer
def withName(name: String): Transformer[In, Out]

Creates a copy of this transformer, but with a different toString

Creates a copy of this transformer, but with a different toString

Value parameters

name

The new "name" (i.e. toString for this transformer

Attributes

Returns

A copy of this transformer whose toString returns the given name

Inherited from:
Transformer

Deprecated and Inherited methods

def >>[Out2](parser: Parser[Out, Out2]): Parser[In, Out2]

Attributes

Deprecated
true
Inherited from:
Transformer
def >>[Out2](next: Transformer[Out, Out2]): Transformer[In, Out2]

Attributes

Deprecated
true
Inherited from:
Transformer
def andThen[Out2](next: Transformer[Out, Out2]): Transformer[In, Out2]

Attributes

Deprecated
true
Inherited from:
Transformer
def parallel[In2 <: In, Out2 >: Out](that: Transformer[In2, Out2]): Transformer[In2, Out2]

Attributes

Deprecated
true
Inherited from:
Transformer
def parallelEither[In2 <: In, Out2](right: Transformer[In2, Out2]): Transformer[In2, Either[Out, Out2]]

Attributes

Deprecated
true
Inherited from:
Transformer
def parseFirstOption: Parser[In, Option[Out]]

Attributes

Deprecated
true
Inherited from:
Transformer
def parseForeach(f: Out => Any): Parser[In, Unit]

Attributes

Deprecated
true
Inherited from:
Transformer
def parseWith[Out2](parser: Parser[Out, Out2], setDebugName: Option[String]): Parser[In, Out2]

Attributes

Deprecated
true
Inherited from:
Transformer
def parseWith[Out2](parser: Parser[Out, Out2]): Parser[In, Out2]

Attributes

Deprecated
true
Inherited from:
Transformer
def sink: Parser[In, Unit]

Attributes

Deprecated
true
Inherited from:
Transformer