Module Async_bus
Async operations on Core_kernel.Bus
.
val pipe1_exn : ('a -> unit, [> Core_kernel.read ]) Bus.t -> Core_kernel.Source_code_position.t -> 'a Async_kernel.Pipe.Reader.t
pipe1_exn t
returns a pipe of updates fromt
by subscribing tot
. Closing the pipe unsubscribes fromt
. Closingt
closes the pipe.pipe1_exn
raises in the same circumstances assubscribe_exn
.
module First_arity : sig ... end
val first_exn : ?stop:unit Async_kernel.Deferred.t -> ('c, [> Core_kernel.read ]) Bus.t -> Core_kernel.Source_code_position.t -> ('c, 'f, 'r) First_arity.t -> f:'f -> 'r Async_kernel.Deferred.t
first_exn here t arity ~f
returns a deferred that becomes determined with valuer
when the first event is published tot
wheref
returnsSome r
.first_exn
then unsubscribes fromt
, ensuring thatf
is never called again after it returnsSome
.first_exn
raises if it can't subscribe to the bus, i.e., ifsubscribe_exn
raises. Iff
raises, thenfirst_exn
raises to the monitor in effect whenfirst_exn
was called.first_exn
takes time proportional to the number of bus subscribers.If
stop
is provided and becomes determined,f
will not be called again, it will unsubscribe from the bus, and the deferred that was returned byfirst_exn
will never become determined.