Cancel action computing this response (Only the party that calls get on a response may cancel).
Optionally get data within timeout
milliseconds.
Optionally get data within timeout
milliseconds.
When interrupted will return with Some(Right(InterruptedException))
When timeout ends, will return last stored provisional result,
or else None if no provisional result was stored.
Get final data, wait as long as necessary.
Get final data, wait as long as necessary. When interrupted will return with Right(InterruptedException)
A cancel request for this response has been issued
Final data set was stored
Store raised exception in data, and mark response as complete.
Set final data, and mark response as complete.
Set provisional data, more to come
(response: StringAdd).self
(response: StringFormat).self
(response: ArrowAssoc[Response[T]]).x
(Since version 2.10.0) Use leftOfArrow
instead
(response: Ensuring[Response[T]]).x
(Since version 2.10.0) Use resultOfEnsuring
instead
Typical interaction, given a predicate <user-input>, a function <display>, and an exception handler <handle>:
val TIMEOUT = 100 // (milliseconds) or something like that val r = new Response() while (!r.isComplete && !r.isCancelled) { if (<user-input>) r.cancel() else r.get(TIMEOUT) match { case Some(Left(data)) => <display>(data) case Some(Right(exc)) => <handle>(exc) case None => } }