module Tail: sig
.. end
A tail is a pointer to the end of a stream that can be used to extend the stream.
type 'a
t
val create : unit -> 'a t
create ()
returns a new tail.
val extend : 'a t -> 'a -> unit
extend t v
extends the stream, and will raise an exception if t
has been
closed.
val close_exn : 'a t -> unit
close_exn t
closes t
. Subsequent calls to close_exn
or extend
will raise an exception.
val close_if_open : 'a t -> unit
close_if_open t
closes t
, if it's not already closed. If t
is already
closed, then this is a no-op.
val is_closed : 'a t -> bool
is_closed t
returns true iff the stream t
is closed.
The Raw
interface and Stream
module exposed here are for async's internal use
only. They must be exported here because we want the Tail.t
and Stream.t
types to
be fully abstract, so that they show up nicely in type errors, yet other async code
defined later needs to deal with the raw types.
include Raw
module Stream: sig
.. end
val collect : 'a t -> 'a Stream.t
collect t
returns the stream starting at the current position of the tail, i.e. the
stream consisting of all subsequent extend
s.
val sexp_of_t : ('a -> Sexplib.Sexp.t) -> 'a t -> Sexplib.Sexp.t
create ()
returns a new tail.
extend t v
extends the stream, and will raise an exception if t
has been
closed.
close_exn t
closes t
. Subsequent calls to close_exn
or extend
will raise an exception.
close_if_open t
closes t
, if it's not already closed. If t
is already
closed, then this is a no-op.
is_closed t
returns true iff the stream t
is closed.
The Raw
interface and Stream
module exposed here are for async's internal use
only. They must be exported here because we want the Tail.t
and Stream.t
types to
be fully abstract, so that they show up nicely in type errors, yet other async code
defined later needs to deal with the raw types.
collect t
returns the stream starting at the current position of the tail, i.e. the
stream consisting of all subsequent extend
s.