Skip to content

Commit

Permalink
TrySeq fix (#29112) (#29139)
Browse files Browse the repository at this point in the history
Co-authored-by: Craig Tiller <[email protected]>
  • Loading branch information
drfloob and ctiller authored Mar 17, 2022
1 parent 9fed1fe commit 525182a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/core/lib/promise/try_seq.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,22 @@ struct TrySeqTraitsWithSfinae<
return run_next(std::move(prior));
}
};
template <>
struct TrySeqTraitsWithSfinae<absl::Status> {
using UnwrappedType = void;
using WrappedType = absl::Status;
template <typename Next>
static auto CallFactory(Next* next, absl::Status&&)
-> decltype(next->Once()) {
return next->Once();
}
template <typename Result, typename RunNext>
static Poll<Result> CheckResultAndRunNext(absl::Status prior,
RunNext run_next) {
if (!prior.ok()) return Result(std::move(prior));
return run_next(std::move(prior));
}
};

template <typename T>
using TrySeqTraits = TrySeqTraitsWithSfinae<T>;
Expand Down

0 comments on commit 525182a

Please sign in to comment.