val create :
can_subscribe_after_start:bool -> 'a t
createcreates a new, unstarted, bus.
can_subscribe_after_start determines whether
subscribe_exn succeeds after the bus
val start :
'a t -> unit
start tstarts the bus; it starts delivery of queued messages to readers.
startwill not run any subscribers; it just creates the Async job that will start running them.
val flushed :
'a t -> unit Import.Deferred.t
flushed treturns a deferred that becomes determined when all subscribers have processed all values previously writen to
val write :
'a t -> 'a -> unit
write t aenqueues
aon the bus, but does not call any subscriber functions immediately. Multiple
writecalls in the same Async cycle are efficient (i.e. they don't create a deferred per item).
module Subscriber :
subscribe_exn t ~fcauses
fto be applied to all values subsequently written to
tis unstarted, to prior values as well).
subscribe_exnraises if it is called on a started bus with
not can_subscribe_after_start. The function
fis allowed to call other
f raises, the corresponding subscriber will be automatically unsubscribed, and
the exception will be sent to the monitor in effect when
subscribe_exn was called.
unsubscribe t subscriber is called,
f will never be called again.
val subscribe_exn :
'a t -> f:('a -> unit) -> 'a Subscriber.t
val unsubscribe :
'a t -> 'a Subscriber.t -> unit
val reader_exn :
'a t -> 'a Import.Pipe.Reader.t
reader_exn treturns a pipe that contains all elements subsequently written to
t(and including prior values, if
tis unstarted). The difference with
subscribe_exnis that the consumer may be an arbitrary amount behind other subscribers/consumers. Pushback on the pipe is not honored. Closing the reader is equivalent to calling
val sexp_of_t :
('a -> Sexplib.Sexp.t) -> 'a t -> Sexplib.Sexp.t