TimeLimits

object TimeLimits extends TimeLimits

Companion object that facilitates the importing of Timeouts members as an alternative to mixing in the trait. One use case is to import Timeouts's members so you can use them in the Scala interpreter.

Companion:
class
class Object
trait Matchable
class Any

Value members

Inherited methods

final inline def cancelAfter[T](timeout: Span)(fun: => T)(implicit signaler: Signaler, prettifier: Prettifier, timed: Timed[T]): T

Executes the passed function, enforcing the passed time limit by attempting to signal the operation if the time limit is exceeded, and "canceling" if the time limit has been exceeded after the function completes, where what it means to "cancel" is determined by the implicitly passed Timed[T] instance.

Executes the passed function, enforcing the passed time limit by attempting to signal the operation if the time limit is exceeded, and "canceling" if the time limit has been exceeded after the function completes, where what it means to "cancel" is determined by the implicitly passed Timed[T] instance.

The Timed companion object offers three implicits, one for FutureOutcome, one for Future[U] and one for any other type. The implicit Timed[FutureOutcome] defines cancelation as canceling the FutureOutcome: no exception will be thrown. The implicit Timed[Future[U]] defines canceling as failing the Future[U] with a TestCanceledException: no exception will be thrown. The implicit for any other type defines failure as throwing TestCanceledException. For the details, see the Scaladoc of the implicit Timed providers in the Timed companion object.

Value parameters:
f

the operation on which to enforce the passed timeout

pos

the Position of the caller site

prettifier

a Prettifier for prettifying error messages

signaler

a strategy for signaling the passed operation

timed

the Timed type class that provides the behavior implementation of the timing restriction.

timeout

the maximimum amount of time allowed for the passed operation

Inherited from:
TimeLimits
final inline def failAfter[T](timeout: Span)(fun: => T)(implicit signaler: Signaler, prettifier: Prettifier, timed: Timed[T]): T

Executes the passed function, enforcing the passed time limit by attempting to signal the operation if the time limit is exceeded, and "failing" if the time limit has been exceeded after the function completes, where what it means to "fail" is determined by the implicitly passed Timed[T] instance.

Executes the passed function, enforcing the passed time limit by attempting to signal the operation if the time limit is exceeded, and "failing" if the time limit has been exceeded after the function completes, where what it means to "fail" is determined by the implicitly passed Timed[T] instance.

The Timed companion object offers three implicits, one for FutureOutcome, one for Future[U] and one for any other type. The implicit Timed[FutureOutcome] defines failure as failing the FutureOutcome with a TestFailedDueToTimeoutException: no exception will be thrown. The implicit Timed[Future[U]] defines failure as failing the Future[U] with a TestFailedDueToTimeoutException: no exception will be thrown. The implicit for any other type defines failure as throwing TestFailedDueToTimeoutException. For the details, see the Scaladoc of the implicit Timed providers in the Timed companion object.

Value parameters:
fun

the operation on which to enforce the passed timeout

pos

the Position of the caller site

prettifier

a Prettifier for prettifying error messages

signaler

a strategy for signaling the passed operation

timed

the Timed type class that provides the behavior implementation of the timing restriction.

timeout

the maximimum amount of time allowed for the passed operation

Inherited from:
TimeLimits