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
/// Convenience method for ignoring the value and creating a Future<Unit>.
/// Exceptions still propagate.
/// Convenience method for ignoring the value and creating a Future<Unit>.
/// Exceptions still propagate.
+ /// This function is identical to .unit().
+ /// 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
/// 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
return then(x, std::forward<Callback>(fn));
}
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() {
// Convert this Future to a SemiFuture to safely export from a library
// without exposing a continuation interface
SemiFuture<T> semi() {