core-lwt
  1. Overview
  2. Docs
type 'a t = 'a bounded_push
val wrap : 'a t -> f:('b -> 'a) -> 'b t
val size : _ t -> int

Size of the stream.

val resize : _ t -> int -> unit

Change the size of the stream queue. Note that the new size can smaller than the current stream queue size.

It raises Invalid_argument if size < 0.

val push : 'a t -> 'a -> unit Core_kernel.Or_error.t Lwt.t

Pushes a new element to the stream. If the stream is full then it will block until one element is consumed. Fails if another thread is already blocked on push.

val push_all : 'a t -> 'a list -> unit Core_kernel.Or_error.t Lwt.t
val close : _ t -> unit

Closes the stream. Any thread currently blocked on push will fail with Closed.

val length : _ t -> int

Number of elements in the stream queue.

val blocked : _ t -> bool

Is a thread is blocked on push ?

val closed : _ t -> bool

Is the stream closed ?

val set_reference : _ t -> 'b -> unit

Set the reference to an external source.