Warning: Reason support is experimental. We are looking for beta-tester and contributors.

Class type Lwt_stream.bounded_push

class type ['a]bounded_push = object..end

Type of sources for bounded push-streams.


method size : int

Size of the stream.

method resize : 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.

method push : 'a -> unit Lwt.t

Pushes a new element to the stream. If the stream is full then it will block until one element is consumed. If another thread is already blocked on Error a_api: exception Dune__exe__Api.Error("\"bounded_push\" is not a valid module name"), it raises Lwt_stream.Full.

method close : unit

Closes the stream. Any thread currently blocked on Error a_api: exception Dune__exe__Api.Error("\"bounded_push\" is not a valid module name") fails with Lwt_stream.Closed.

method count : int

Number of elements in the stream queue.

method blocked : bool

Is a thread is blocked on Error a_api: exception Dune__exe__Api.Error("\"bounded_push\" is not a valid module name") ?

method closed : bool

Is the stream closed ?

method set_reference : 'a0. 'a0 -> unit

Set the reference to an external source.