Ice.FutureLike

class Ice.FutureLike(*args, **kwargs)

Bases: Protocol[_T_co]

A protocol that defines an interface for objects that behave like a Future.

add_done_callback(callback: Callable[[FutureLike], Any], /) None

Adds a callback to be run when the Future is done.

Parameters:

callback (Callable[[FutureLike], Any]) – A callable that takes the Future object as its only argument. Will be called when the Future completes (successfully, with exception, or cancelled).

Return type:

None

result(timeout: int | float | None = None) _T_co

Retrieves the result of the Future.

If the Future has not completed, this function will wait up to timeout-many seconds for it to finish.

Parameters:

timeout (int | float | None, optional) – Maximum time (in seconds) to wait for the result. If None (the default), this function waits indefinitely until the operation completes.

Returns:

The result of the Future.

Return type:

object