Class containing methods that return a Span
time value calculated from the
Double
value passed to the FloatingGrainOfTime
constructor.
Class containing methods that return a Span
time value calculated from the
Double
value passed to the FloatingGrainOfTime
constructor.
Class containing methods that return a Span
time value calculated from the
Long
value passed to the GrainOfTime
constructor.
Class containing methods that return a Span
time value calculated from the
Long
value passed to the GrainOfTime
constructor.
Implicit conversion that adds time units methods to Double
s.
Implicit conversion that adds time units methods to Double
s.
a FloatingGrainOfTime
wrapping the passed Double
Implicit conversion that adds time units methods to Float
s.
Implicit conversion that adds time units methods to Float
s.
a FloatingGrainOfTime
wrapping the passed Float
Implicit conversion that adds time units methods to Int
s.
Implicit conversion that adds time units methods to Int
s.
a GrainOfTime
wrapping the passed Int
Implicit conversion that adds time units methods to Long
s.
Implicit conversion that adds time units methods to Long
s.
a GrainOfTime
wrapping the passed Long
Trait providing four implicit conversions that allow you to specify spans of time by invoking "units" methods such as
millis
,seconds
, andminutes
onInt
,Long
,Float
, andDouble
.This trait enables you to specify a span of time in a clear, boilerplate-free way when you need to provide an instance of
Span
. This can be used, for example, with thefailAfter
method of traitTimeouts
or thetimeLimit
field of traitTimeLimitedTests
. It can also be used to specify timeouts when using traitsEventually
,Futures
,Waiter
. Here are examples of each unit enabled by this trait:Int
Long
Float
Double
This trait is not the default way to specify
Span
s for two reasons. First, it adds four implicits, which would give the compiler more work to do and may conflict with other implicits the user has in scope. Instead,Span
provides a clear, concise default way to specify time spans that requires no implicits. Here's an example:If you already have implicit conversions in scope that provide a similar syntax sugar for expression time spans, you can use that by providing an implicit conversion from the result of those expressions to
Span
. Note that because of implicit conversions in theSpan
companion object, you can use ascala.concurrent.duration.Duration
(including in its "sugary" form) where aSpan
is needed, and vice versa.