module Stream(T)
Overview
A suckless reactive stream toolkit.
Defined in:
aspis/stream.crConstructors
-
.new
Creates and returns a stream.
Instance Method Summary
-
#all(from a : Stream(M), until b : Stream(K), now = false) forall M, K
Starts to emit when a emits, and stops to emit when b emits.
-
#batch(count : Int32)
Emits objects from this stream in batches of count elements.
-
#each(func : T -> )
Calls func before emitting an object unchanged.
-
#each(&func : T -> )
Calls func before emitting an object unchanged.
-
#emit(object : T)
Emits object to all streams that are subscribed to this stream.
-
#forget(stream)
Unsubscribes stream from events in this stream.
-
#join(other : Stream(T))
Unordrered concatenation: emits objects from both streams.
-
#map(&func : T -> U) forall U
Emits an object transformed by func.
-
#notifies(stream)
Subscribes stream to this stream.
-
#reject(&func : T -> Bool)
Emits only those objects for which func returns false.
-
#reject(pattern)
Emits only those objects that do not match against pattern (using
===
). -
#select(&func : T -> Bool)
Emits only those objects for which func returns true.
-
#select(type : U.class) forall U
Emits only those objects that are of the given type.
-
#select(pattern)
Emits only those objects that match against pattern (using
===
). -
#uniq(&func : T -> U) forall U
Emits only if the result of func is not equal (
==
) to the last emitted value. -
#uniq
Emits only if the emitted object is not equal to the previous emitted object.
- #zip(other : Stream(U)) : Stream(Tuple(T, U)) forall U
Constructor Detail
Instance Method Detail
Starts to emit when a emits, and stops to emit when b emits. now can be passed to skip waiting for a to emit the first time.
Unordrered concatenation: emits objects from both streams.
Emits only those objects that are of the given type.
Emits only if the result of func is not equal (==
)
to the last emitted value.
The first object is always emitted.