BiCallback

object BiCallback
Companion
class
class Object
trait Matchable
class Any

Type members

Classlikes

final class Builders[E](val ev: Boolean) extends AnyVal

Functions exposed via apply.

Functions exposed via apply.

Value members

Concrete methods

def apply[E]: Builders[E]

For building BiCallback objects using the Partially-Applied Type technique.

For building BiCallback objects using the Partially-Applied Type technique.

For example these are Equivalent:

BiCallback[Throwable].empty[String] <-> BiCallback.empty[Throwable, String]

def empty[E, A](r: UncaughtExceptionReporter): BiCallback[E, A]

Creates an empty BiCallback, a callback that doesn't do anything in onNext and that logs errors in onError with the provided monix.execution.UncaughtExceptionReporter.

Creates an empty BiCallback, a callback that doesn't do anything in onNext and that logs errors in onError with the provided monix.execution.UncaughtExceptionReporter.

def forked[E, A](cb: BiCallback[E, A])(ec: ExecutionContext): BiCallback[E, A]

Given a BiCallback wraps it into an implementation that calls onSuccess and onError asynchronously, using the given scala.concurrent.ExecutionContext.

Given a BiCallback wraps it into an implementation that calls onSuccess and onError asynchronously, using the given scala.concurrent.ExecutionContext.

The async boundary created is "light", in the sense that a TrampolinedRunnable is used and supporting schedulers can execute these using an internal trampoline, thus execution being faster and immediate, but still avoiding growing the call-stack and thus avoiding stack overflows.

'''THREAD-SAFETY''': the returned callback is thread-safe.

   In case `onSuccess` and `onError` get called multiple times,
   from multiple threads even, the implementation protects against
   access violations and throws a
   [[monix.execution.exceptions.CallbackCalledMultipleTimesException CallbackCalledMultipleTimesException]].
See also
def fromAttempt[E, A](cb: Either[Cause[E], A] => Unit): BiCallback[E, A]

Turns Either[Cause[E], A] => Unit callbacks into Monix callbacks.

Turns Either[Cause[E], A] => Unit callbacks into Monix callbacks.

These are common within Cats' implementation, used for example in cats.effect.IO.

WARNING: the returned callback is NOT thread-safe!

def fromPromise[E, A](p: Promise[Either[E, A]]): BiCallback[E, A]

Returns a BiCallback instance that will complete the given promise.

Returns a BiCallback instance that will complete the given promise.

THREAD-SAFETY: the provided instance is thread-safe by virtue of Promise being thread-safe.

def fromTry[A](cb: Try[A] => Unit): BiCallback[Throwable, A]

Turns Try[A] => Unit callbacks into Monix callbacks.

Turns Try[A] => Unit callbacks into Monix callbacks.

These are common within Scala's standard library implementation, due to usage with Scala's Future.

WARNING: the returned callback is NOT thread-safe!

def safe[E, A](cb: BiCallback[E, A])(r: UncaughtExceptionReporter): BiCallback[E, A]

Wraps any BiCallback into a safer implementation that protects against protocol violations (e.g. onSuccess or onError must be called at most once).

Wraps any BiCallback into a safer implementation that protects against protocol violations (e.g. onSuccess or onError must be called at most once).

'''THREAD-SAFETY''': the returned callback is thread-safe.

   In case `onSuccess` and `onError` get called multiple times,
   from multiple threads even, the implementation protects against
   access violations and throws a
   [[monix.execution.exceptions.CallbackCalledMultipleTimesException CallbackCalledMultipleTimesException]].
def trampolined[E, A](cb: BiCallback[E, A])(ec: ExecutionContext): BiCallback[E, A]

Given a BiCallback wraps it into an implementation that calls onSuccess and onError asynchronously, using the given scala.concurrent.ExecutionContext.

Given a BiCallback wraps it into an implementation that calls onSuccess and onError asynchronously, using the given scala.concurrent.ExecutionContext.

The async boundary created is "light", in the sense that a TrampolinedRunnable is used and supporting schedulers can execute these using an internal trampoline, thus execution being faster and immediate, but still avoiding growing the call-stack and thus avoiding stack overflows.

'''THREAD-SAFETY''': the returned callback is thread-safe.

   In case `onSuccess` and `onError` get called multiple times,
   from multiple threads even, the implementation protects against
   access violations and throws a
   [[monix.execution.exceptions.CallbackCalledMultipleTimesException CallbackCalledMultipleTimesException]].
See also