Allows to create a ``Future`` from a plain value. The resulting ``Future`` will just return the given value wrapped in :class:`returns.io.IO` container when awaited. .. code:: python >>> import anyio >>> from returns.future import Future
(cls, inner_value: _NewValueType)
| 383 | |
| 384 | @classmethod |
| 385 | def from_value(cls, inner_value: _NewValueType) -> 'Future[_NewValueType]': |
| 386 | """ |
| 387 | Allows to create a ``Future`` from a plain value. |
| 388 | |
| 389 | The resulting ``Future`` will just return the given value |
| 390 | wrapped in :class:`returns.io.IO` container when awaited. |
| 391 | |
| 392 | .. code:: python |
| 393 | |
| 394 | >>> import anyio |
| 395 | >>> from returns.future import Future |
| 396 | >>> from returns.io import IO |
| 397 | |
| 398 | >>> async def main() -> bool: |
| 399 | ... return (await Future.from_value(1)) == IO(1) |
| 400 | |
| 401 | >>> assert anyio.run(main) is True |
| 402 | |
| 403 | """ |
| 404 | return Future(async_identity(inner_value)) |
| 405 | |
| 406 | @classmethod |
| 407 | def from_future( |
no test coverage detected