Commit 05ced584 authored by Stiopa Koltsov's avatar Stiopa Koltsov Committed by Facebook Github Bot

future.then() is identical to future.unit()

Summary:
Document that `future.then()` is identical to `future.unit()`.

Put functions next to each other to make it clear, and use identical
wording.

Reviewed By: yfeldblum

Differential Revision: D5955451

fbshipit-source-id: 1b55d5785dc0995d4d9364f48241e98ad01b31f4
parent 6a1cf45e
......@@ -374,8 +374,16 @@ class Future : public SemiFuture<T> {
/// Convenience method for ignoring the value and creating a Future<Unit>.
/// Exceptions still propagate.
/// This function is identical to .unit().
Future<Unit> then();
/// Convenience method for ignoring the value and creating a Future<Unit>.
/// Exceptions still propagate.
/// This function is identical to parameterless .then().
Future<Unit> unit() {
return then();
}
/// Set an error callback for this Future. The callback should take a single
/// argument of the type that you want to catch, and should return a value of
/// the same type as this Future, or a Future of that type (see overload
......@@ -567,11 +575,6 @@ class Future : public SemiFuture<T> {
return then(x, std::forward<Callback>(fn));
}
/// Discard a result, but propagate an exception.
Future<Unit> unit() {
return then([]{ return Unit{}; });
}
// Convert this Future to a SemiFuture to safely export from a library
// without exposing a continuation interface
SemiFuture<T> semi() {
......
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