The goal here is to provide an implicit instance for ContextShift[Rerunnable]
, so you can use libraries like
fs2
in a finagle-based application without converting between Future
and IO
everywhere.
The goal here is to provide an implicit instance for ContextShift[Rerunnable]
, so you can use libraries like
fs2
in a finagle-based application without converting between Future
and IO
everywhere.
Usage:
implicit val rerunnableCS: ContextShift[Rerunnable] = RerunnableContextShift.global
Can be used to construct a cats.effect.Timer
instance for Rerunnable
which let's you delay execution or
retrieve the current time via RerunnableClock
.
Can be used to construct a cats.effect.Timer
instance for Rerunnable
which let's you delay execution or
retrieve the current time via RerunnableClock
.
Usage:
// In a Finagle application implicit val timer: Timer[Rerunnable] = RerunnableTimer(com.twitter.finagle.util.DefaultTimer) // In tests (for instant execution of delays) implicit val timer: Timer[Rerunnable] = RerunnableTimer(com.twitter.util.Timer.Nil) // A dedicated `JavaTimer` implicit val timer: Timer[Rerunnable] = RerunnableTimer()
Converts the Future
to F
without changing the underlying execution (same thread pool!).
The same as futureToAsync
but doesn't stay on the thread pool of the Future
and instead shifts execution
back to the one provided by ContextShift[F]
(which is usually the default one).
The same as futureToAsync
but doesn't stay on the thread pool of the Future
and instead shifts execution
back to the one provided by ContextShift[F]
(which is usually the default one).
This is likely what you want when you interact with libraries that return a Future
like finagle-http
where
the Future
is running on a thread pool controlled by the library (e.g. the underlying Netty pool).
It also is closer to the behavior of IO.fromFuture
for Scala futures which also shifts back.
Converts the Rerunnable
to F
without changing the underlying execution (same thread pool!).
The same as rerunnableToIO
but doesn't stay on the thread pool of the Rerunnable
and instead shifts execution
back to the one provided by ContextShift[F]
(which is usually the default one).
Convert a twitter-util Try to cats-effect ExitCase