zio.channel
Members list
Type members
Classlikes
An implementation of a thread-safe, blocking channel.
An implementation of a thread-safe, blocking channel.
Type parameters
- A
-
the type of messages in the queue
Value parameters
- capacity
-
the capacity of the channel
- done
-
a promise that is completed when the channel is closed
- nonEmpty
-
a ref that allows us to wait for the possibility of a successful receive
- queue
-
the underlying queue used to store messages
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
An implementation of a thread-safe, blocking channel. This is based on the Golang channels, Channel
implementation in Stackless Python, and also on Erlang message passing with mailbox.
An implementation of a thread-safe, blocking channel. This is based on the Golang channels, Channel
implementation in Stackless Python, and also on Erlang message passing with mailbox.
Effects can send messages to the queue using the send
method, which will block until the message is received. Effects can also receive messages from the queue using the receive
method, which will block until a message is available.
Type parameters
- A
-
the type of messages in the queue
Attributes
Object representing a closed channel.
Object representing a open channel.
Value members
Concrete methods
Runs the effect while the condition is true
Runs the effect while the condition is true
===Sample===
foreverWhile:
for
res <- ZIO.whenCaseZIO(channel.receive):
case Right(data) =>
Console.printLine(s"Received: $data") *> ZIO.succeed(true)
case Left(Closed) =>
Console.printLine(s"Channel closed") *> ZIO.succeed(false)
yield res.get
Value parameters
- effect
-
the effect to run that returns a boolean
Attributes
- Returns
-
a ZIO that runs the effect forever while the condition is true