gopher.SelectLoop.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 SelectLoop[F[_]](api: Gopher[F]) extends SelectGroupBuilder[F,Boolean, Unit](api):
transparent inline def apply(inline pf: PartialFunction[Any,Boolean]): Unit =
${
Select.loopImpl[F]('pf, 'api )
}
def runAsync(): F[Unit] =
given m: CpsSchedulingMonad[F] = api.asyncMonad
async[F]{
while{
val group = api.select.group[Boolean]
val build = groupBuilder(group)
val r = build.run()
r
} do ()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy