trait _Trait[+A] extends AnyRef

Future Value

Future represents value which will be available 'at some point of time', but it can already be incorporated in current calculations

val s = "Hello"

val v: Future[String] = Future(s + " Concurrent Future!")

v.resultOpt.lp      // Value is likely not available yet

v.onComplete(print) // Will run when value is available

// Output
Opt.Void
Out(Hello Concurrent Future!)
Ordering
  1. Alphabetic
Inherited
  1. Future
  2. scala.AnyRef
  3. scala.Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Method

  1. def apply[B](f: (A) ⇒ Any, d: (Deficiency) ⇒ Any = \/)(implicit e: ExecutionContext = DEFAULT): Future[A]
    Definition Classes
    _Trait
  2. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  3. def await(v: Util.Time.PreciseDuration)(implicit e: ExecutionContext = DEFAULT): Util.Out[A]
    Definition Classes
    _Trait
  4. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  5. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  6. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  7. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  8. def hashCode(): Int
    Definition Classes
    AnyRef → Any
  9. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  10. def letMap[B](f: (A) ⇒ Util.Out[B])(implicit e: ExecutionContext = DEFAULT): Future[B]
    Definition Classes
    _Trait
  11. def map[B](f: (A) ⇒ B)(implicit e: ExecutionContext = DEFAULT): Future[B]
    Definition Classes
    _Trait
  12. def mapResult[B](f: (Util.Out[A]) ⇒ Util.Out[B])(implicit e: ExecutionContext): Future[B]

    Map outcome

    Map outcome

    Creates a new Future value, which outcome is mapped from this value outcome

    val v1 = Future { 2 * 2 }
    val v2 = v1.map(_.validate(_ > 10, "Too Small"))
    
    v1.onComplete("v1: " + _ lp)
    v2.onComplete("v2: " + _ lp)
    
    
    // Output
    v1: Out(4)
    v3: Out(deficiency=Too Small)
    Definition Classes
    _Trait
  13. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. final def notify(): Unit
    Definition Classes
    AnyRef
  15. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  16. abstract def resultOpt: Opt[Util.Out[A]]

    Optional outcome

    Optional outcome

    Returns calculation outcome if it is available

    val v = Future{ 2 * 2 }
    
    v.resultOpt lp      // Likely prints: Opt.Void
    
    App.pause(1.Second)
    
    v.resultOpt lp      // Likely prints: Opt(Out(4))
    Definition Classes
    _Trait
  17. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  18. def toString(): String
    Definition Classes
    AnyRef → Any
  19. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  20. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. def zip[B](f: Future[B])(implicit e: ExecutionContext = DEFAULT): Future[(A, B)]
    Definition Classes
    _Trait

Operator

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any

Event

  1. abstract def onComplete(f: (Util.Out[A]) ⇒ Unit)(implicit e: ExecutionContext = DEFAULT): Unit

    Run when ready

    Run when ready

    Will run the given function, when the outcome will get available

    val v = Future{ 2 * 2 }
    
    v.onComplete("onComplete: " + _ lp)
    
    "Immediate Result: " + v.resultOpt lp
    
    // Output
    Immediate Result: Opt(Out(4))
    onComplete: Out(4)
    Definition Classes
    _Trait

Hidden

  1. def _flatMap[B](m: (A) ⇒ Future[B])(implicit e: ExecutionContext = DEFAULT): Future[B]
    Attributes
    protected
    Definition Classes
    _Trait
Linear Supertypes
AnyRef, Any
Source: _Trait.scala