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]
- Alphabetic
- By Inheritance
- Fiber
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
await: UIO[Exit[E, A]]
Awaits the fiber, which suspends the awaiting fiber until the result of the fiber has been determined.
Awaits the fiber, which suspends the awaiting fiber until the result of the fiber has been determined.
- returns
UIO[Exit[E, A]]
-
abstract
def
inheritFiberRefs: UIO[Unit]
Inherits values from all FiberRef instances into current fiber.
Inherits values from all FiberRef instances into current fiber. This will resume immediately.
- returns
UIO[Unit]
-
abstract
def
interrupt: UIO[Exit[E, A]]
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.
- returns
UIO[Exit, E, A]]
-
abstract
def
poll: UIO[Option[Exit[E, A]]]
Tentatively observes the fiber, but returns immediately if it is not already done.
Tentatively observes the fiber, but returns immediately if it is not already done.
- returns
UIO[Option[Exit, E, A]]]
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
*>[E1 >: E, B](that: Fiber[E1, B]): Fiber[E1, B]
Same as
zip
but discards the output of the left hand side.Same as
zip
but discards the output of the left hand side.- E1
error type
- B
type of the fiber
- that
fiber to be zipped
- returns
Fiber[E1, B]
combined fiber
-
final
def
<*[E1 >: E, B](that: Fiber[E1, B]): Fiber[E1, A]
Same as
zip
but discards the output of the right hand side.Same as
zip
but discards the output of the right hand side.- E1
error type
- B
type of the fiber
- that
fiber to be zipped
- returns
Fiber[E1, A]
combined fiber
-
final
def
<*>[E1 >: E, B](that: ⇒ Fiber[E1, B]): Fiber[E1, (A, B)]
Zips this fiber and the specified fiber together, producing a tuple of their output.
Zips this fiber and the specified fiber together, producing a tuple of their output.
- E1
error type
- B
type of that fiber
- that
fiber to be zipped
- returns
Fiber[E1, (A, B)]
combined fiber
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
as[B](b: ⇒ B): Fiber[E, B]
Maps the output of this fiber to the specified constant.
Maps the output of this fiber to the specified constant.
- B
type of the fiber
- b
constant
- returns
Fiber[E, B]
fiber mapped to constant
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
join: IO[E, A]
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.
- returns
IO[E, A]
-
final
def
map[B](f: (A) ⇒ B): Fiber[E, B]
Maps over the value the Fiber computes.
Maps over the value the Fiber computes.
- B
result type of f
- f
mapping function
- returns
Fiber[E, B]
mapped fiber
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
orElse[E1 >: E, A1 >: A](that: Fiber[E1, A1]): Fiber[E1, A1]
Returns a fiber that prefers
this
fiber, but falls back to thethat
one whenthis
one fails.Returns a fiber that prefers
this
fiber, but falls back to thethat
one whenthis
one fails. Interrupt call on such a fiber interrupts both (this
andthat
) fibers in sequential order.- E1
error type
- A1
type of the fiber
- that
fiber to fall back to
- returns
Fiber[E1, A1]
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
final
def
toFuture(implicit ev: <:<[E, Throwable]): UIO[Future[A]]
Converts this fiber into a scala.concurrent.Future.
Converts this fiber into a scala.concurrent.Future.
- ev
implicit witness that E is a subtype of Throwable
- returns
UIO[Future[A]]
-
final
def
toFutureWith(f: (E) ⇒ Throwable): UIO[Future[A]]
Converts this fiber into a scala.concurrent.Future, translating any errors to java.lang.Throwable with the specified conversion function.
Converts this fiber into a scala.concurrent.Future, translating any errors to java.lang.Throwable with the specified conversion function.
- f
function to the error into a Throwable
- returns
UIO[Future[A]]
-
final
def
toManaged: ZManaged[Any, Nothing, Fiber[E, A]]
Converts this fiber into a zio.ZManaged.
Converts this fiber into a zio.ZManaged. Fiber is interrupted on release.
- returns
ZManaged[Any, Nothing, Fiber[E, A]]
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
unit: Fiber[E, Unit]
Maps the output of this fiber to
()
.Maps the output of this fiber to
()
.- returns
Fiber[E, Unit]
fiber mapped to()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
final
def
zip[E1 >: E, B](that: ⇒ Fiber[E1, B]): Fiber[E1, (A, B)]
Named alias for
<*>
.Named alias for
<*>
.- E1
error type
- B
type of that fiber
- that
fiber to be zipped
- returns
Fiber[E1, (A, B)]
combined fiber
-
final
def
zipLeft[E1 >: E, B](that: Fiber[E1, B]): Fiber[E1, A]
Named alias for
<*
.Named alias for
<*
.- E1
error type
- B
type of the fiber
- that
fiber to be zipped
- returns
Fiber[E1, A]
combined fiber
-
final
def
zipRight[E1 >: E, B](that: Fiber[E1, B]): Fiber[E1, B]
Named alias for
*>
.Named alias for
*>
.- E1
error type
- B
type of the fiber
- that
fiber to be zipped
- returns
Fiber[E1, B]
combined fiber
-
final
def
zipWith[E1 >: E, B, C](that: ⇒ Fiber[E1, B])(f: (A, B) ⇒ C): Fiber[E1, C]
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.
- E1
error type
- B
type of that fiber
- C
type of the resulting fiber
- that
fiber to be zipped
- f
function to combine the results of both fibers
- returns
Fiber[E1, C]
combined fiber