package picos_std
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=862d61383e2df93a876bedcffb1fd1ddc0f96c50b0e9c07943a2aee1f0e182be
sha512=87805379017ef4a7f2c11b954625a3757a0f1431bb9ba59132202de278b3e41adbe0cdc20e3ab23b7c9a8c5a15faeb7ec79348e7d80f2b14274b00df0893b8c0
doc/picos_std.sync/Picos_std_sync/Stream/index.html
Module Picos_std_sync.Stream
Source
A lock-free, poisonable, many-to-many, stream.
Readers can tap
into a stream to get a cursor
for reading all the values pushed to the stream starting from the cursor
position. Conversely, values pushed to a stream are lost unless a reader has a cursor
to the position in the stream.
Represents a stream of values of type 'a
.
poison stream exn bt
marks the stream as poisoned at the current position, which means that subsequent attempts to push
to the stream
will raise the given exception with backtrace.
Represents a (past or current) position in a stream.
peek_opt cursor
immediately returns Some (value, next)
with the value
pushed to the position and a cursor to the next
position, when the cursor
points to a past position in the stream. Otherwise returns None
or raises the exception that the stream was poisoned with.
read cursor
immediately returns (value, next)
with the value
pushed to the position and a cursor to the next
position, when the cursor
points to a past position in the stream. If the cursor
points to the current position of the stream, read cursor
waits until a value is pushed to the stream or the stream is poisoned, in which case the exception that the stream was poisoned with will be raised.
read_evt cursor
returns an event that reads from the cursor
position.