Commit 0bf289ce authored by Lee Howes's avatar Lee Howes Committed by Facebook Github Bot

Future<T>::then Future<T>::then() -> Future<T>::thenValue or thenTry.

Summary:
Part of the larger project to modify Future<T>::then to be r-value qualified and use Future<T>::thenTry or Future<T>::thenValue.

The goal is to disambiguate folly::Future and to improve type and lifetime safety of Future and its methods.

Codemod:
  future<T>.then(callable with operator()(not-a-try)) to future<T>.thenValue(callable with operator()(not-a-try)).
  future<T>.then(callable with operator()()) to future<T>.thenValue(callable with operator()(auto&&)).
  future<T>.then(callable with operator()(auto)) to future<T>.thenValue(callable with operator()(auto)).
  future<T>.then(callable with operator()(folly::Try<T>)) to future<T>.thenTry(callable)

Reviewed By: Orvid

Differential Revision: D10859128

fbshipit-source-id: 6df42d7d9bee324a118c114ff7ada76f93d94268
parent 6143f6f3
...@@ -1218,7 +1218,7 @@ Future<T>::onError(F&& func) && { ...@@ -1218,7 +1218,7 @@ Future<T>::onError(F&& func) && {
template <class T> template <class T>
template <class F> template <class F>
Future<T> Future<T>::ensure(F&& func) && { Future<T> Future<T>::ensure(F&& func) && {
return std::move(*this).then( return std::move(*this).thenTry(
[funcw = std::forward<F>(func)](Try<T>&& t) mutable { [funcw = std::forward<F>(func)](Try<T>&& t) mutable {
std::forward<F>(funcw)(); std::forward<F>(funcw)();
return makeFuture(std::move(t)); return makeFuture(std::move(t));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment