Movatterモバイル変換


[0]ホーム

URL:


Scala 3
3.7.4
LearnInstallPlaygroundFind A LibraryCommunityBlog
Scala 3
LearnInstallPlaygroundFind A LibraryCommunityBlog
DocsAPI
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL
Scala 3/scala/scala.concurrent/Promise

Promise

scala.concurrent.Promise
See thePromise companion object
traitPromise[T]

Promise is an object which can be completed with a value or failed with an exception.

A promise should always eventually be completed, whether for success or failure, in order to avoid unintended resource retention for any associated Futures' callbacks or transformations.

Attributes

Companion
object
Source
Promise.scala
Graph
Supertypes
classObject
traitMatchable
classAny

Members list

Value members

Abstract methods

Future containing the value of this promise.

Future containing the value of this promise.

Attributes

Source
Promise.scala

Returns whether the promise has already been completed with a value or an exception.

Returns whether the promise has already been completed with a value or an exception.

Note: Using this method may result in non-deterministic concurrent programs.

Attributes

Returns

true if the promise is already completed,false otherwise

Source
Promise.scala
deftryComplete(result:Try[T]):Boolean

Tries to complete the promise with either a value or the exception.

Tries to complete the promise with either a value or the exception.

Note: Using this method may result in non-deterministic concurrent programs.

Attributes

Returns

If the promise has already been completed returnsfalse, ortrue otherwise.

Source
Promise.scala

Concrete methods

defcomplete(result:Try[T]):this.type

Completes the promise with either an exception or a value.

Completes the promise with either an exception or a value.

Value parameters

result

Either the value or the exception to complete the promise with. If the promise has already been fulfilled, failed or has timed out, calling this method will throw an IllegalStateException.

Attributes

Source
Promise.scala
defcompleteWith(other:Future[T]):this.type

Completes this promise with the specified future, once that future is completed.

Completes this promise with the specified future, once that future is completed.

Attributes

Returns

This promise

Source
Promise.scala
deffailure(cause:Throwable):this.type

Completes the promise with an exception.

Completes the promise with an exception.

Value parameters

cause

The throwable to complete the promise with. If the throwable used to fail this promise is an error, a control exception or an interrupted exception, it will be wrapped as a cause within anExecutionException which will fail the promise. If the promise has already been fulfilled, failed or has timed out, calling this method will throw an IllegalStateException.

Attributes

Source
Promise.scala
defsuccess(value:T):this.type

Completes the promise with a value.

Completes the promise with a value.

Value parameters

value

The value to complete the promise with. If the promise has already been fulfilled, failed or has timed out, calling this method will throw an IllegalStateException.

Attributes

Source
Promise.scala

Tries to complete the promise with an exception.

Tries to complete the promise with an exception.

Note: Using this method may result in non-deterministic concurrent programs.

Attributes

Returns

If the promise has already been completed returnsfalse, ortrue otherwise.

Source
Promise.scala
deftrySuccess(value:T):Boolean

Tries to complete the promise with a value.

Tries to complete the promise with a value.

Note: Using this method may result in non-deterministic concurrent programs.

Attributes

Returns

If the promise has already been completed returnsfalse, ortrue otherwise.

Source
Promise.scala

Deprecated methods

finaldeftryCompleteWith(other:Future[T]):this.type

Attempts to complete this promise with the specified future, once that future is completed.

Attempts to complete this promise with the specified future, once that future is completed.

Attributes

Returns

This promise

Deprecated
[Since version 2.13.0]Since this method is semantically equivalent to `completeWith`, use that instead.
Source
Promise.scala
In this article
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL

[8]ページ先頭

©2009-2025 Movatter.jp