diff --git a/3.0/docs/async/futures.md b/3.0/docs/async/futures.md index fca1ce98..718e384d 100644 --- a/3.0/docs/async/futures.md +++ b/3.0/docs/async/futures.md @@ -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 diff --git a/3.0/docs/async/futuretype.md b/3.0/docs/async/futuretype.md new file mode 100644 index 00000000..3208ce01 --- /dev/null +++ b/3.0/docs/async/futuretype.md @@ -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)