final class ReferenceOps[T] extends AnyVal
- Alphabetic
- By Inheritance
- ReferenceOps
- AnyVal
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new ReferenceOps(value: async.Future[T])
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
##(): Int
- Definition Classes
- Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- Any
-
def
asIO: async.IO[T]
!!! USE WITH CARE !!! Most likely you want to use FutureOps.suspendInIO which ensures that it suspends the side effects of the given future (if it created by the given expression, if it's a val, then good luck).
!!! USE WITH CARE !!! Most likely you want to use FutureOps.suspendInIO which ensures that it suspends the side effects of the given future (if it created by the given expression, if it's a val, then good luck).
Having to care about such val/def distinctions shows why Future is an imperative programming mess.
- Annotations
- @inline()
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
asTask: async.Task[T]
!!! USE WITH CARE !!! Most likely you want to use FutureOps.suspendInTask which ensures that it suspends the side effects of the given future (if it created by the given expression, if it's a val, then good luck).
!!! USE WITH CARE !!! Most likely you want to use FutureOps.suspendInTask which ensures that it suspends the side effects of the given future (if it created by the given expression, if it's a val, then good luck).
Having to care about such val/def distinctions shows why Future is an imperative programming mess.
- Annotations
- @inline()
-
def
attempResult(implicit ec: async.ExecutionContext): async.Future[sync.Result[T]]
Makes the failure, and non-failure part of this effect explicit in a busymachines.effects.sync.Result type.
Makes the failure, and non-failure part of this effect explicit in a busymachines.effects.sync.Result type.
This transforms any failed effect, into a pure one with and busymachines.effects.sync.Incorrect value.
- Annotations
- @inline()
-
def
bimap[R](result: (sync.Result[T]) ⇒ sync.Result[R])(implicit ec: async.ExecutionContext): async.Future[R]
Similar to the overload, but the busymachines.effects.sync.Correct branch of the result is used to change the "pure" branch of this effect, and busymachines.effects.sync.Incorrect branch is used to change the "fail" branch of the effect.
Similar to the overload, but the busymachines.effects.sync.Correct branch of the result is used to change the "pure" branch of this effect, and busymachines.effects.sync.Incorrect branch is used to change the "fail" branch of the effect.
- Annotations
- @inline()
-
def
bimap[R](good: (T) ⇒ R, bad: (Throwable) ⇒ Anomaly)(implicit ec: async.ExecutionContext): async.Future[R]
Used to transform both the "pure" part of the effect, and the "fail" part.
Used to transform both the "pure" part of the effect, and the "fail" part. Hence the name "bi" map, because it also allows you to change both branches of the effect, not just the happy path.
- Annotations
- @inline()
-
def
bimapThr[R](good: (T) ⇒ R, bad: (Throwable) ⇒ Throwable)(implicit ec: async.ExecutionContext): async.Future[R]
Similar to the overload, but the busymachines.effects.sync.Correct branch of the result is used to change the "pure" branch of this effect, and busymachines.effects.sync.Incorrect branch is used to change the "fail" branch of the effect.
Similar to the overload, but the busymachines.effects.sync.Correct branch of the result is used to change the "pure" branch of this effect, and busymachines.effects.sync.Incorrect branch is used to change the "fail" branch of the effect.
The overload that uses java.lang.Throwable instead of busymachines.core.Anomaly
- Annotations
- @inline()
-
def
discardContent(implicit ec: async.ExecutionContext): async.Future[Unit]
Explicitely discard the contents of this effect, and return Unit instead.
Explicitely discard the contents of this effect, and return Unit instead.
N.B. computation, and side-effects captured within this effect are still executed, it's just the final value that is discarded
- Annotations
- @inline()
-
def
getClass(): Class[_ <: AnyVal]
- Definition Classes
- AnyVal → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
morph[R](result: (sync.Result[T]) ⇒ R)(implicit ec: async.ExecutionContext): async.Future[R]
Semantically equivalent to the overload
that accepts two functions, but those encoded as the corresponding branches of a Result type.morph
Semantically equivalent to the overload
that accepts two functions, but those encoded as the corresponding branches of a Result type.morph
Undefined behavior if you throw exceptions in the method. DO NOT do that!
- Annotations
- @inline()
-
def
morph[R](good: (T) ⇒ R, bad: (Throwable) ⇒ R)(implicit ec: async.ExecutionContext): async.Future[R]
Given the basic two-pronged nature of this effect.
Given the basic two-pronged nature of this effect. the
function transforms the underlying "pure" (correct, successful, etc) if that's the case. thegood
function transforms the underlying "failure" part of the effect into a "pure" part.bad
Therefore, by using
you are defining the rules by which to make the effect into a successful one that does not short-circuit monadic flatMap chains.morph
e.g:
val f: Future[Int] = Future.fail(InvalidInputFailure) Future.morph(f, (i: Int) => i *2, (t: Throwable) => 42)
Undefined behavior if you throw exceptions in the method. DO NOT do that!
- Annotations
- @inline()
-
def
toString(): String
- Definition Classes
- Any
-
def
unsafeSyncGet(atMost: duration.FiniteDuration = ...): T
!!! USE WITH CARE !!!
!!! USE WITH CARE !!!
Mostly here for testing. There is almost no reason whatsover for you to explicitely call this in your code. You have libraries that do this for you "at the end of the world" parts of your program: e.g. akka-http when waiting for the response value to a request.
- Annotations
- @inline()
- val value: async.Future[T]