FilterType Operator

Rocket.filter_typeFunction
filter_type(type::Type{ T }) where { T }

Creates a filter_type operator, which filters items of the source Observable by emitting only those that match a specified T type with a <: operator. This operator is a more efficient version of filter(v -> v <: T) |> map(T, v -> v) operators chain.

Producing

Stream of type <: Subscribable{ T } where T refers to type argument

Examples

using Rocket

source = from(Real[ 1, 2.0, 3, 4.0, 5, 6.0 ])
subscribe!(source |> filter_type(Int), logger())
;

# output

[LogActor] Data: 1
[LogActor] Data: 3
[LogActor] Data: 5
[LogActor] Completed

See also: AbstractOperator, InferableOperator, ProxyObservable, logger

source

See also

Operators