gopher.SelectForever.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scala-gopher_3.0.0-RC2 Show documentation
Show all versions of scala-gopher_3.0.0-RC2 Show documentation
scala-gopher: asynchronous implementation of CSP ( go-like channels/selectors ) in scala
The newest version!
package gopher
import cps._
import scala.quoted._
import scala.compiletime._
import scala.concurrent.duration._
class SelectForever[F[_]](api: Gopher[F]) extends SelectGroupBuilder[F,Unit, Unit](api):
transparent inline def apply(inline pf: PartialFunction[Any,Unit]): Unit =
${
Select.foreverImpl('pf,'api)
}
transparent inline def applyAsync(inline pf: PartialFunction[Any,F[Unit]]): Unit =
???
def runAsync(): F[Unit] =
given CpsSchedulingMonad[F] = api.asyncMonad
async[F]{
while{
val group = api.select.group[Unit]
try
groupBuilder(group).run()
true
catch
case ex: ChannelClosedException =>
false
} do ()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy