Array Observable

Rocket.fromFunction
from(x)

Creation operator for the ArrayObservable that emits either a single value if x has a Scalar trait specification or a collection of values if x has a NonScalar trait specification. Throws an ErrorException if x has UndefinedScalarness trait type. To specify scalarness for arbitrary type T some can implement an additional method for scalarness(::Type{<:MyType}) function and to specify scalarness behavior.

Arguments

  • x: an object to be wrapped into array of values

Examples

using Rocket

source = from([ 0, 1, 2 ])
subscribe!(source, logger())
;

# output

[LogActor] Data: 0
[LogActor] Data: 1
[LogActor] Data: 2
[LogActor] Completed
using Rocket

source = from(( 0, 1, 2 ))
subscribe!(source, logger())
;

# output

[LogActor] Data: 0
[LogActor] Data: 1
[LogActor] Data: 2
[LogActor] Completed
using Rocket

source = from(0)
subscribe!(source, logger())
;

# output

[LogActor] Data: 0
[LogActor] Completed
using Rocket

source = from("Hello, world!")
subscribe!(source, logger())
;

# output

[LogActor] Data: H
[LogActor] Data: e
[LogActor] Data: l
[LogActor] Data: l
[LogActor] Data: o
[LogActor] Data: ,
[LogActor] Data:
[LogActor] Data: w
[LogActor] Data: o
[LogActor] Data: r
[LogActor] Data: l
[LogActor] Data: d
[LogActor] Data: !
[LogActor] Completed

See also: ArrayObservable, subscribe!, logger

source
Rocket.ArrayObservableType
ArrayObservable{D}(values::Vector{D})

ArrayObservable wraps a regular Julia array into a synchronous observable

Constructor arguments

  • values: array of values to be wrapped

See also: Subscribable, from

source