A Sink is an object used to create a Stream. If you have ever visited a kitchen or bathroom
you have probably observed this phenomena already. In more technical terms, Sinks are the
‘write’ part of functional reactive programming, and Streams are the ‘read’ part.
Streams are objects that emit events in sequence as they are created. Streams are
similar to Iterators in Rust in that both represent a sequence of values and both
can be modified by ‘pipe’ functions like map and filter. The difference is that
all values of an iterator are known immediately (or, at least, execution will block
while the next item is retrieved), whereas it would not be uncommon for a stream to
live for the entire duration of a program, emitting new values from time-to-time.
A Subscription object ties a stream to a listener function such that the listener function is
run whenever a new value is added to the stream. When the Subscription object is destroyed
the listener function will stop getting called.