reactive_signal/channel
Types
Functions
pub fn subscribe(
channel: Channel(a),
new_subscriber: fn(a) -> Nil,
) -> Nil
Subscribe to a channel Subscriber is start as a new process, and exit when the next value is published, or parent process is exit.
pub fn subscribe_from_subject(
channel: Channel(a),
subscriber_subject: Subject(a),
) -> Nil
Subscribe to a channel by Subject. Subject will receive messages when the channel value is updated.
pub fn subscribe_with_wait_next(
channel: Channel(a),
new_subscriber: fn(a, fn() -> Nil) -> Nil,
) -> Nil
Subscribe to a channel Subscriber is start as a new process, and exit when the next value is published, or parent process is exit.
pub fn try_modify(
channel: Channel(a),
f: fn(a) -> a,
) -> Result(a, CallError(a))
Apply function to channel value safely
pub fn try_write(
channel: Channel(a),
s: a,
) -> Result(Nil, CallError(a))
Write value to channel safely