Module NesLwt_stream

include module type of Lwt_stream
type 'a t
val from : (unit -> 'a option Lwt.t) -> 'a t
val from_direct : (unit -> 'a option) -> 'a t
exception Closed
val create : unit -> 'a t * ('a option -> unit)
val create_with_reference : unit -> 'a t * ('a option -> unit) * ('b -> unit)
exception Full
class type !'a bounded_push = object ... end
val create_bounded : int -> 'a t * 'a bounded_push
val return : 'a -> 'a t
val return_lwt : 'a Lwt.t -> 'a t
val of_seq : 'a Stdlib.Seq.t -> 'a t
val of_lwt_seq : 'a Lwt_seq.t -> 'a t
val of_list : 'a list -> 'a t
val of_array : 'a array -> 'a t
val of_string : string -> char t
val clone : 'a t -> 'a t
val to_list : 'a t -> 'a list Lwt.t
val to_string : char t -> string Lwt.t
exception Empty
val peek : 'a t -> 'a option Lwt.t
val npeek : int -> 'a t -> 'a list Lwt.t
val get : 'a t -> 'a option Lwt.t
val nget : int -> 'a t -> 'a list Lwt.t
val get_while : ('a -> bool) -> 'a t -> 'a list Lwt.t
val get_while_s : ('a -> bool Lwt.t) -> 'a t -> 'a list Lwt.t
val next : 'a t -> 'a Lwt.t
val last_new : 'a t -> 'a Lwt.t
val junk : 'a t -> unit Lwt.t
val njunk : int -> 'a t -> unit Lwt.t
val junk_while : ('a -> bool) -> 'a t -> unit Lwt.t
val junk_while_s : ('a -> bool Lwt.t) -> 'a t -> unit Lwt.t
val junk_available : 'a t -> unit
val get_available : 'a t -> 'a list
val get_available_up_to : int -> 'a t -> 'a list
val is_empty : 'a t -> bool Lwt.t
val is_closed : 'a t -> bool
val closed : 'a t -> unit Lwt.t
val junk_old : 'a t -> unit Lwt.t
  • deprecated Use junk_available instead
val choose : 'a t list -> 'a t
val map : ('a -> 'b) -> 'a t -> 'b t
val map_s : ('a -> 'b Lwt.t) -> 'a t -> 'b t
val filter : ('a -> bool) -> 'a t -> 'a t
val filter_s : ('a -> bool Lwt.t) -> 'a t -> 'a t
val filter_map : ('a -> 'b option) -> 'a t -> 'b t
val filter_map_s : ('a -> 'b option Lwt.t) -> 'a t -> 'b t
val map_list : ('a -> 'b list) -> 'a t -> 'b t
val map_list_s : ('a -> 'b list Lwt.t) -> 'a t -> 'b t
val fold : ('a -> 'b -> 'b) -> 'a t -> 'b -> 'b Lwt.t
val fold_s : ('a -> 'b -> 'b Lwt.t) -> 'a t -> 'b -> 'b Lwt.t
val iter : ('a -> unit) -> 'a t -> unit Lwt.t
val iter_p : ('a -> unit Lwt.t) -> 'a t -> unit Lwt.t
val iter_s : ('a -> unit Lwt.t) -> 'a t -> unit Lwt.t
val iter_n : ?max_concurrency:int -> ('a -> unit Lwt.t) -> 'a t -> unit Lwt.t
val find : ('a -> bool) -> 'a t -> 'a option Lwt.t
val find_s : ('a -> bool Lwt.t) -> 'a t -> 'a option Lwt.t
val find_map : ('a -> 'b option) -> 'a t -> 'b option Lwt.t
val find_map_s : ('a -> 'b option Lwt.t) -> 'a t -> 'b option Lwt.t
val combine : 'a t -> 'b t -> ('a * 'b) t
val append : 'a t -> 'a t -> 'a t
val concat : 'a t t -> 'a t
val flatten : 'a list t -> 'a t
val wrap_exn : 'a t -> ('a, exn) Stdlib.result t
val parse : 'a t -> ('a t -> 'b Lwt.t) -> 'b Lwt.t
val hexdump : char t -> string t
type 'a next =
  1. | Next of 'a
  2. | Last of 'a
val from_next : (unit -> 'a next Lwt.t) -> 'a t

Variant of from for when the function can return a “last” element. The stream is terminated after it.

val get_available_1 : 'a t -> 'a option

Variant of get_available that returns only the first element. Note that None, in this case, represents the absence of elements, not the end of the stream.

val choose_biased : 'a t list -> 'a t

Variant of Lwt_stream.choose that tries to pick in order. If one of the streams gets closed, then it raises Lwt_stream.Empty. FIXME: we could continue with the other streams until they are all closed.