Module Async_kernel__.Async_stream
module Deferred = Async_kernel__.Deferred1type 'a t= 'a Async_kernel.Tail.Stream.tsexp_of_t t freturns a sexp of all of the elements currently available in the stream. It is just for display purposes. There is not_of_sexp.
val sexp_of_t : ('a -> Ppx_sexp_conv_lib.Sexp.t) -> 'a t -> Ppx_sexp_conv_lib.Sexp.t
val create : ('a Async_kernel.Tail.t -> unit) -> 'a tcreate freturns a streamtand callsf tail, where the elements of the stream are determined as the tail is extended, and the end of the stream is reached when the tail is closed.
type 'a next=|Nil|Cons of 'a * 'a tnext treturns a deferred that will become determined when the next part of the stream is determined. This isCons (v, t'), where v is the next element of the stream and t' is the rest of the stream, or with Nil at the end of the stream.
val next : 'a t -> 'a next Deferred.tval first_exn : 'a t -> 'a Deferred.tfirst_exn treturns a deferred that becomes determined with the first element oft.
val of_list : 'a list -> 'a tof_list lreturns a stream with the elements of list l.
val to_list : 'a t -> 'a list Deferred.tto_list treturns a deferred that will become determined with the list of elements in t, if the end of t is reached.
val of_fun : (unit -> 'a Deferred.t) -> 'a tof_fun freturns a stream whose elements are determined by callingfforever.
val copy_to_tail : 'a t -> 'a Async_kernel.Tail.t -> unit Deferred.tcopy_to_tail t tailreads elements fromtand puts them intail, until the end oftis reached.
val append : 'a t -> 'a t -> 'a tappend t1 t2returns a stream with all the values of t1, in order, and if t1 ends, these values are followed by all the values of t2.
val concat : 'a t t -> 'a tconcat ttakes a stream of streams and produces a stream that is the concatenation of each stream in order (you see all of stream 1, then all of stream 2... etc.)
val available_now : 'a t -> 'a list * 'a tavailable_now treturns t prefix of t that is available now, along with the rest of the stream.
val filter_deprecated : 'a t -> f:('a -> bool) -> 'a tfilter_deprecated s ~freturns a stream with one element, v, for each v in s such with f v = true.Using
filter_deprecatedcan easily lead to space leaks. It is better to useAsync.PipethanAsync.Stream.
val filter_map_deprecated : 'a t -> f:('a -> 'b option) -> 'b tfilter_map_deprecated s ~freturns a stream with one element, v', for each v in s such with f v = Some v'.Using
filter_map_deprecatedcan easily lead to space leaks. It is better to useAsync.PipethanAsync.Stream.
val fold' : 'a t -> init:'b -> f:('b -> 'a -> 'b Deferred.t) -> 'b Deferred.tfold' t ~init ~fis like list fold, walking over the elements of the stream in order, as they become available.fold'returns a deferred that will yield the final value of the accumulator, if the end of the stream is reached.
val fold : 'a t -> init:'b -> f:('b -> 'a -> 'b) -> 'b Deferred.tfold t ~init ~fis a variant offold'in whichfdoes not return a deferred.
val iter' : 'a t -> f:('a -> unit Deferred.t) -> unit Deferred.titer' t ~fappliesfto each element of the stream in turn, as they become available. It continues onto the next element only after the deferred returned byfbecomes determined.
val closed : _ t -> unit Deferred.tclosed treturns a deferred that becomes determined when the end oftis reached.
val iter : 'a t -> f:('a -> unit) -> unititer t ~f=don't_wait_for (iter' t ~f:(fun a -> f a; return ()))
val take_until : 'a t -> unit Deferred.t -> 'a ttake_until t dreturns a streamt'that has the same elements astup untildbecomes determined.
val iter_durably' : 'a t -> f:('a -> unit Deferred.t) -> unit Deferred.titer_durably' t ~fis likeiter' t ~f, except iffraises an exception it continues with the next element of the stream *and* reraises the exception (to the monitor in scope when iter_durably was called).iter_durably t ~fis likeiter t ~f, except iffraises an exception it continues with the next element of the stream *and* reraises the exception (to the monitor in scope when iter_durably was called).iter_durably_report_end t ~fis equivalent toiter_durably' t ~f:(fun x -> return (f x))but it is more efficient
val iter_durably : 'a t -> f:('a -> unit) -> unitval iter_durably_report_end : 'a t -> f:('a -> unit) -> unit Deferred.tval length : 'a t -> int Deferred.tlength sreturns a deferred that is determined when the end of s is reached, taking the value of the number of elements in s
val map' : 'a t -> f:('a -> 'b Deferred.t) -> 'b tmap' t fcreates a new stream that with one element, (f v), for each element v of t.
val map : 'a t -> f:('a -> 'b) -> 'b tmap t ~fcreates a new stream that with one element, (f v), for each element v of t.map t f=map' t ~f:(fun a -> return (f a)).
val first_n : 'a t -> int -> 'a tfirst_n t nreturns a stream with the first n elements of t, if t has n or more elements, or it returns t.
val unfold : 'b -> f:('b -> ('a * 'b) option Deferred.t) -> 'a tunfold b freturns a streama1; a2; ...; anwhose elements are determined by the equations:b0 = b Some (a1, b1) = f b0 Some (a2, b2) = f b1 ... None = f bn
val split : ?stop:unit Deferred.t -> ?f:('a -> [ `Continue | `Found of 'b ]) -> 'a t -> 'a t * [ `End_of_stream | `Stopped of 'a t | `Found of 'b * 'a t ] Deferred.tsplit ~stop ~f treturns a pair(p, d), wherepis a prefix oftthat ends for one of three reasons:1. [t] ends 2. stop becomes determined 3. f returns `FoundThe deferred
ddescribes why the prefix ended, and returns the suffix of the stream in case (2) or (3).
val find : 'a t -> f:('a -> bool) -> [ `End_of_stream | `Found of 'a * 'a t ] Deferred.tfind ~f treturns a deferred that becomes determined whenf xis true for some element oft, or if the end of the stream is reached