mirror of https://github.com/vapor/docs.git
Added futuretype docs
This commit is contained in:
parent
78c6fe4f8c
commit
2e4a948a07
|
|
@ -1,6 +1,6 @@
|
|||
# Future basics
|
||||
|
||||
Futures are used throughout Vapor, so it is useful to know some of the available helpers. We explain the reasoning and use cases [here](../concepts/async.md).
|
||||
Futures are used throughout Vapor, so it is useful to know some of the available helpers. We explain the reasoning and use cases [here](../concepts/async.md). They are the primary [`FutureType`](futuretype.md) implementation.
|
||||
|
||||
## Adding awaiters to all results
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
# FutureType
|
||||
|
||||
FutureType is a protocol defining any entity that provides the ability to register callback closures for an object that _may_ be returned in the future.
|
||||
|
||||
FutureTypes call the registered closure with either an error or the `Expectation`. FutureTypes _may_ return this in the future. The can, instead, also call the closure immediately.
|
||||
|
||||
This pattern is adopted by [`Response`](../http/response.md) among other types. We recommend libraries to be generic to FutureType rather than depending on a specific implementation such as [`Future`](futures.md)
|
||||
Loading…
Reference in New Issue