Added futuretype docs

This commit is contained in:
Joannis Orlandos 2017-11-27 00:19:27 +01:00
parent 78c6fe4f8c
commit 2e4a948a07
2 changed files with 8 additions and 1 deletions

View File

@ -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

View File

@ -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)