BiCallback

abstract class BiCallback[-E, -A] extends Either[Cause[E], A] => Unit

Callback type which supports two channels of errors.

Callback type which supports two channels of errors.

Companion
object
trait Either[Cause[E], A] => Unit
class Object
trait Matchable
class Any

Value members

Abstract methods

def onError(e: E): Unit

Signals an error.

Signals an error.

Can be called at most once by contract. Not necessarily thread-safe, depends on implementation.

def onSuccess(value: A): Unit

Signals a successful value.

Signals a successful value.

Can be called at most once by contract. Not necessarily thread-safe, depends on implementation.

def onTermination(e: Throwable): Unit

Signals a a terminal error which will not be reflected in the type signature.

Signals a a terminal error which will not be reflected in the type signature.

Can be called at most once by contract. Not necessarily thread-safe, depends on implementation.

Concrete methods

def apply(result: Either[Cause[E], A]): Unit

Signals a value via Scala's Either where

Signals a value via Scala's Either where

  • Leftis a typed error
  • Right is a successful value

Can be called at most once by contract. Not necessarily thread-safe, depends on implementation.

def apply(result: Try[Either[E, A]]): Unit

Signals a value via Scala's Try of Either where

Signals a value via Scala's Try of Either where

  • Left is a typed error
  • Right is a successful value
  • Failure is a terminal error (a defect))

Can be called at most once by contract. Not necessarily thread-safe, depends on implementation.

def apply(result: Try[A])(ev: Throwable <:< E): Unit

Signals a value via Scala's Try.

Signals a value via Scala's Try.

Can be called at most once by contract. Not necessarily thread-safe, depends on implementation.

def contramap[B](f: B => A): BiCallback[E, B]

Return a new callback that will apply the supplied function before passing the result into this callback.

Return a new callback that will apply the supplied function before passing the result into this callback.

def tryApply(result: Either[Cause[E], A]): Boolean

Attempts to call BiCallback.apply.

Attempts to call BiCallback.apply.

In case the underlying callback implementation protects against protocol violations, then this method should return false in case the final result was already signaled once via onSuccess, onError or onTermination.

   The default implementation relies on catching
   [[monix.execution.exceptions.CallbackCalledMultipleTimesException CallbackCalledMultipleTimesException]]
   in case of violations, which is what thread-safe implementations
   of `onSuccess` or `onError` are usually throwing.

   WARNING: this method is only provided as a
   convenience. The presence of this method does not
   guarantee that the underlying callback is thread-safe or
   that it protects against protocol violations.
def tryApply(result: Try[A])(ev: Throwable <:< E): Boolean

Attempts to call BiCallback.apply.

Attempts to call BiCallback.apply.

In case the underlying callback implementation protects against protocol violations, then this method should return false in case the final result was already signaled once via onSuccess, onError or onTermination.

   The default implementation relies on catching
   [[monix.execution.exceptions.CallbackCalledMultipleTimesException CallbackCalledMultipleTimesException]]
   in case of violations, which is what thread-safe implementations
   of `onSuccess` or `onError` are usually throwing.

   WARNING: this method is only provided as a
   convenience. The presence of this method does not
   guarantee that the underlying callback is thread-safe or
   that it protects against protocol violations.
def tryOnError(e: E): Boolean

Attempts to call BiCallback.onError.

Attempts to call BiCallback.onError.

In case the underlying callback implementation protects against protocol violations, then this method should return false in case the final result was already signaled once via onSuccess, onError or onTermination.

   The default implementation relies on catching
   [[monix.execution.exceptions.CallbackCalledMultipleTimesException CallbackCalledMultipleTimesException]]
   in case of violations, which is what thread-safe implementations
   of `onSuccess` or `onError` are usually throwing.

   WARNING: this method is only provided as a
   convenience. The presence of this method does not
   guarantee that the underlying callback is thread-safe or
   that it protects against protocol violations.
def tryOnSuccess(value: A): Boolean

Attempts to call BiCallback.onSuccess.

Attempts to call BiCallback.onSuccess.

In case the underlying callback implementation protects against protocol violations, then this method should return false in case the final result was already signaled once via onSuccess, onError or onTermination.

   The default implementation relies on catching
   [[monix.execution.exceptions.CallbackCalledMultipleTimesException CallbackCalledMultipleTimesException]]
   in case of violations, which is what thread-safe implementations
   of `onSuccess` or `onError` are usually throwing.

   WARNING: this method is only provided as a
   convenience. The presence of this method does not
   guarantee that the underlying callback is thread-safe or
   that it protects against protocol violations.
def tryOnTermination(e: Throwable): Boolean

Attempts to call BiCallback.onTermination.

Attempts to call BiCallback.onTermination.

In case the underlying callback implementation protects against protocol violations, then this method should return false in case the final result was already signaled once via onSuccess, onError or onTermination.

   The default implementation relies on catching
   [[monix.execution.exceptions.CallbackCalledMultipleTimesException CallbackCalledMultipleTimesException]]
   in case of violations, which is what thread-safe implementations
   of `onSuccess` or `onError` are usually throwing.

   WARNING: this method is only provided as a
   convenience. The presence of this method does not
   guarantee that the underlying callback is thread-safe or
   that it protects against protocol violations.

Inherited methods

@unspecialized
def andThen[A](g: Unit => A): Either[Cause[E], A] => A
Inherited from
Function1
@unspecialized
def compose[A](g: A => Either[Cause[E], A]): A => Unit
Inherited from
Function1
override def toString(): String
Definition Classes
Function1 -> Any
Inherited from
Function1