Trait/Object

zio

Fiber

Related Docs: object Fiber | package zio

Permalink

trait Fiber[+E, +A] extends AnyRef

A fiber is a lightweight thread of execution that never consumes more than a whole thread (but may consume much less, depending on contention). Fibers are spawned by forking IO actions, which, conceptually at least, runs them concurrently with the parent IO action.

Fibers can be joined, yielding their result other fibers, or interrupted, which terminates the fiber with a runtime error.

Fork-Join Identity: fork >=> join = id

for {
  fiber1 <- io1.fork
  fiber2 <- io2.fork
  _      <- fiber1.interrupt(e)
  a      <- fiber2.join
} yield a
Self Type
Fiber[E, A]
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Fiber
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def await: UIO[Exit[E, A]]

    Permalink

    Awaits the fiber, which suspends the awaiting fiber until the result of the fiber has been determined.

  2. abstract def inheritFiberRefs: UIO[Unit]

    Permalink

    Inherits values from all FiberRef instances into current fiber.

    Inherits values from all FiberRef instances into current fiber. This will resume immediately.

  3. abstract def interrupt: UIO[Exit[E, A]]

    Permalink

    Interrupts the fiber with no specified reason.

    Interrupts the fiber with no specified reason. If the fiber has already terminated, either successfully or with error, this will resume immediately. Otherwise, it will resume when the fiber terminates.

  4. abstract def poll: UIO[Option[Exit[E, A]]]

    Permalink

    Tentatively observes the fiber, but returns immediately if it is not already done.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def *>[E1 >: E, B](that: Fiber[E1, B]): Fiber[E1, B]

    Permalink

    Same as zip but discards the output of the left hand side.

  4. final def <*[E1 >: E, B](that: Fiber[E1, B]): Fiber[E1, A]

    Permalink

    Same as zip but discards the output of the right hand side.

  5. final def <*>[E1 >: E, B](that: ⇒ Fiber[E1, B]): Fiber[E1, (A, B)]

    Permalink

    Zips this fiber and the specified fiber together, producing a tuple of their output.

  6. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  7. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  8. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. final def const[B](b: ⇒ B): Fiber[E, B]

    Permalink

    Maps the output of this fiber to the specified constant.

  10. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  14. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  15. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  16. final def join: IO[E, A]

    Permalink

    Joins the fiber, which suspends the joining fiber until the result of the fiber has been determined.

    Joins the fiber, which suspends the joining fiber until the result of the fiber has been determined. Attempting to join a fiber that has errored will result in a catchable error, _if_ that error does not result from interruption.

  17. final def map[B](f: (A) ⇒ B): Fiber[E, B]

    Permalink

    Maps over the value the Fiber computes.

  18. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  19. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  20. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  21. def orElse[E1 >: E, A1 >: A](that: Fiber[E1, A1]): Fiber[E1, A1]

    Permalink

    Returns a fiber that prefers this fiber, but falls back to the that one when this one fails.

    Returns a fiber that prefers this fiber, but falls back to the that one when this one fails. Interrupt call on such a fiber interrupts both (this and that) fibers in sequential order.

  22. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  23. final def toFuture(implicit ev: <:<[E, Throwable]): UIO[Future[A]]

    Permalink

    Converts this fiber into a scala.concurrent.Future.

  24. final def toFutureWith(f: (E) ⇒ Throwable): UIO[Future[A]]

    Permalink

    Converts this fiber into a scala.concurrent.Future, translating any errors to java.lang.Throwable with the specified conversion function.

  25. final def toManaged: ZManaged[Any, Nothing, Fiber[E, A]]

    Permalink

    Converts this fiber into a zio.ZManaged.

    Converts this fiber into a zio.ZManaged. Fiber is interrupted on release.

  26. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  27. final def unit: Fiber[E, Unit]

    Permalink

    Maps the output of this fiber to ().

  28. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  31. final def zip[E1 >: E, B](that: ⇒ Fiber[E1, B]): Fiber[E1, (A, B)]

    Permalink

    Named alias for <*>.

  32. final def zipLeft[E1 >: E, B](that: Fiber[E1, B]): Fiber[E1, A]

    Permalink

    Named alias for <*.

  33. final def zipRight[E1 >: E, B](that: Fiber[E1, B]): Fiber[E1, B]

    Permalink

    Named alias for *>.

  34. final def zipWith[E1 >: E, B, C](that: ⇒ Fiber[E1, B])(f: (A, B) ⇒ C): Fiber[E1, C]

    Permalink

    Zips this fiber with the specified fiber, combining their results using the specified combiner function.

    Zips this fiber with the specified fiber, combining their results using the specified combiner function. Both joins and interruptions are performed in sequential order from left to right.

Deprecated Value Members

  1. final def void: Fiber[E, Unit]

    Permalink

    Maps the output of this fiber to ().

    Maps the output of this fiber to ().

    Annotations
    @deprecated
    Deprecated

    (Since version 1.0.0) use unit

Inherited from AnyRef

Inherited from Any

Ungrouped