Utils

Rocket.setTimeoutFunction
setTimeout(f::Function, timeout::Int)

Creates a Task which will asynchornously invoke fucntion f after specified timeout time in milliseconds.

Arguments

  • f::Function, function to be invoked asynchronously
  • timeout::Int, timeout in milliseconds

Examples

using Rocket
using Dates

println("Before: ", Dates.format(now(), "MM:SS"))
setTimeout(1000) do
    println("Inside: ", Dates.format(now(), "MM:SS"))
end
println("Right after: ", Dates.format(now(), "MM:SS"))
;

# Logs
# Before: 20:59
# Right after: 20:59
# Inside: 21:00
source
Rocket.combined_typeFunction
combined_type(sources)

Returns a Tuple el-type of observable el-types in sources argument in the same order

source
Rocket.union_typeFunction
union_type(sources)

Returns a Union el-type of observable el-types in sources argument

source

Helpers

Rocket.@MStorageMacro
@MStorage(n::Int)

Helper function to generate tuple-like structure MStorageN, but with mutable fields and empty constructor. It is possible then to take a snapshot(::MStorage) which returns a tuple with the same types and values from storage. Some operators and observables use pregenerated MStorage to instatiate uninitialized mutable storage in case when stream is allowed to not emit any values before completion.

Generated structure layout

struct MStorageN{V1, V2, ..., VN}
    v1 :: V1
    v2 :: V2
    ...
    vn :: VN
end

See also: setstorage!

source
Rocket.setstorage!Function
setstorage!(s, v, ::Val{I}) where I

This function can be used to set a new value v for storage s with a given value v and index I. Using parametrized Val{I} for indexing ensures for index to be resolved at compile-time and if-else branch optimization.

See also: @MStorage

source