Ice.wrap_future¶
- Ice.wrap_future(future: Future | Future, *, loop: AbstractEventLoop | None = None) Future¶
Wrap an
Ice.Futureobject into anasyncio.Future.This function converts an Ice.Future into an asyncio.Future to allow integration of Ice’s asynchronous operations with Python’s asyncio framework. If the provided future is already an asyncio.Future, it is returned unchanged.
If the Ice.Future is already completed, the asyncio.Future is immediately resolved. Otherwise, completion callbacks are registered to ensure that the asyncio.Future reflects the state of the Ice.Future, including result propagation, exception handling, and cancellation.
- Parameters:
future (Future | asyncio.Future) – The Ice.Future object to wrap. If an asyncio.Future is passed, it is returned as-is.
loop (asyncio.AbstractEventLoop, optional) – The event loop to associate with the asyncio.Future. If not provided, the current event loop is used.
- Returns:
A future that mirrors the state of the input Ice.Future.
- Return type:
- Raises:
AssertionError – If future is not an instance of Ice.Future or asyncio.Future.