We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8dee925 commit 1844aa4Copy full SHA for 1844aa4
core/src/main/scala/ox/fork.scala
@@ -217,6 +217,13 @@ trait Fork[T]:
217
case e: InterruptedException => Left(e)
218
case NonFatal(e) => Left(e)
219
220
+object Fork:
221
+ /** A dummy pretending to represent a fork which successfully completed with the given value. */
222
+ def successful[T](value: T): Fork[T] = () => value
223
+
224
+ /** A dummy pretending to represent a fork which failed with the given exception. */
225
+ def failed[T](e: Throwable): Fork[T] = () => throw e
226
227
/** A fork started using [[forkCancellable]], backed by a (virtual) thread. */
228
trait CancellableFork[T] extends Fork[T]:
229
/** Interrupts the fork, and blocks until it completes with a result. */
0 commit comments