AnyFuture
public struct AnyFuture<Output> : FutureProtocol
A type-erasing future.
Use AnyFuture
to wrap a future whose type has details you don’t want to
expose. This is typically the case when returning futures from a function
or storing futures in properties.
You can also use AnyFuture
to create a custom future by providing a
closure for the poll
method, rather than implementing FutureProtocol
directly on a custom type.
-
-
Creates a type-erasing future implemented by the provided closure.
Declaration
Swift
@inlinable public init(_ pollFn: @escaping PollFn)
-
Creates a type-erasing future to wrap the provided future.
This initializer performs a heap allocation unless the wrapped future is already type-erased.
Declaration
Swift
@inlinable public init<F>(_ future: F) where Output == F.Output, F : FutureProtocol
-
-
Declaration