Skip to content

Commit

Permalink
avoid generic type in Netty's RunAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
fwbrasil committed Feb 21, 2024
1 parent 2be43a1 commit d3dd86f
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ trait NettyCatsServerInterpreter[F[_]] {

implicit val monad: MonadError[F] = new CatsMonadError[F]
val runAsync = new RunAsync[F] {
override def apply[T](f: => F[T]): Unit = nettyServerOptions.dispatcher.unsafeRunAndForget(f)
override def apply(f: => F[Unit]): Unit = nettyServerOptions.dispatcher.unsafeRunAndForget(f): Unit
}
implicit val bodyListener: BodyListener[F, NettyResponse] = new NettyBodyListener(runAsync)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ trait NettyIdServerInterpreter {
new NettyToResponseBody[Id],
nettyServerOptions.deleteFile,
new RunAsync[Id] {
override def apply[T](f: => Id[T]): Unit = {
override def apply(f: => Id[Unit]): Unit = {
val _ = f
()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ object NettyFutureServerInterpreter {
}

private object FutureRunAsync extends RunAsync[Future] {
override def apply[T](f: => Future[T]): Unit = f
override def apply(f: => Future[Unit]): Unit = f: Unit
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package sttp.tapir.server.netty.internal

trait RunAsync[F[_]] {
def apply[T](f: => F[T]): Unit
def apply(f: => F[Unit]): Unit
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ object NettyZioServerInterpreter {
}

private[netty] class ZioRunAsync[R](runtime: Runtime[R]) extends RunAsync[RIO[R, *]] {
override def apply[T](f: => RIO[R, T]): Unit = Unsafe.unsafe(implicit u => runtime.unsafe.runToFuture(f))
override def apply(f: => RIO[R, Unit]): Unit = Unsafe.unsafe(implicit u => runtime.unsafe.runToFuture(f)): Unit
}
}

0 comments on commit d3dd86f

Please sign in to comment.