proxygen
folly::expected_detail::expected_detail_ExpectedHelper::ExpectedHelper Struct Reference

#include <Expected.h>

Static Public Member Functions

template<class Error , class T >
static constexpr Expected< T, Error > return_ (T t)
 
template<class Error , class T , class U , bool FB_CONCATENATE = false, typename std::enable_if< (FB_CONCATENATE(FB_CONCATENATE(Folly, Requires), __LINE__)||static_cast< bool >(expected_detail::IsConvertible< U &&, Error >::value)), int >::type = 0>
static constexpr Expected< T, Error > return_ (Expected< T, U > t)
 
template<class This >
static std::decay< This >::type then_ (This &&ex)
 
template<class This , class Fn , class... Fns, class E = ExpectedErrorType<This>, class T = ExpectedHelper>
static FOLLY_PUSH_WARNING auto then_ (This &&ex, Fn &&fn, Fns &&...fns) -> decltype(T::then_(T::template return_< E >((std::declval< Fn >()(std::declval< This >().value()), unit)), std::declval< Fns >()...))
 
template<class This , class Yes , class No , class Ret = decltype(std::declval<Yes>()(std::declval<This>().value())), class Err = decltype(std::declval<No>()(std::declval<This>().error())), bool FB_CONCATENATE = false, typename std::enable_if< (FB_CONCATENATE(FB_CONCATENATE(Folly, Requires), __LINE__)||static_cast< bool >(!std::is_void< Err >::value)), int >::type = 0>
static Ret thenOrThrow_ (This &&ex, Yes &&yes, No &&no)
 
template<class This , class Yes , class No , class Ret = decltype(std::declval<Yes>()(std::declval<This>().value())), class Err = decltype(std::declval<No>()(std::declval<This&>().error())), bool FB_CONCATENATE = false, typename std::enable_if< (FB_CONCATENATE(FB_CONCATENATE(Folly, Requires), __LINE__)||static_cast< bool >(std::is_void< Err >::value)), int >::type = 0>
static Ret thenOrThrow_ (This &&ex, Yes &&yes, No &&no)
 

Detailed Description

Definition at line 572 of file Expected.h.

Member Function Documentation

template<class Error , class T >
static constexpr Expected<T, Error> folly::expected_detail::expected_detail_ExpectedHelper::ExpectedHelper::return_ ( T  t)
inlinestatic

Definition at line 574 of file Expected.h.

References FOLLY_REQUIRES_TRAILING, folly::pushmi::detail::t, and folly::T.

574  {
575  return folly::makeExpected<Error>(t);
576  }
template<class Error , class T , class U , bool FB_CONCATENATE = false, typename std::enable_if< (FB_CONCATENATE(FB_CONCATENATE(Folly, Requires), __LINE__)||static_cast< bool >(expected_detail::IsConvertible< U &&, Error >::value)), int >::type = 0>
static constexpr Expected<T, Error> folly::expected_detail::expected_detail_ExpectedHelper::ExpectedHelper::return_ ( Expected< T, U >  t)
inlinestatic

Definition at line 582 of file Expected.h.

References folly::pushmi::detail::t.

582  {
583  return t;
584  }
template<class This >
static std::decay<This>::type folly::expected_detail::expected_detail_ExpectedHelper::ExpectedHelper::then_ ( This &&  ex)
inlinestatic

Definition at line 587 of file Expected.h.

References FOLLY_MSVC_DISABLE_WARNING, and FOLLY_PUSH_WARNING.

587  {
588  return static_cast<This&&>(ex);
589  }
template<class This , class Fn , class... Fns, class E = ExpectedErrorType<This>, class T = ExpectedHelper>
static FOLLY_PUSH_WARNING auto folly::expected_detail::expected_detail_ExpectedHelper::ExpectedHelper::then_ ( This &&  ex,
Fn &&  fn,
Fns &&...  fns 
) -> decltype(T::then_( T::template return_<E>( (std::declval<Fn>()(std::declval<This>().value()), unit)), std::declval<Fns>()...))
inlinestatic

Definition at line 600 of file Expected.h.

References folly::pushmi::operators::error(), folly::expected_detail::eValue, FOLLY_REQUIRES_TRAILING, LIKELY, folly::makeUnexpected(), fizz::server::detail::No, folly::unit, value, folly::value(), and fizz::server::detail::Yes.

603  {
604  if (LIKELY(ex.which_ == expected_detail::Which::eValue)) {
605  return T::then_(
606  T::template return_<E>(
607  // Uses the comma operator defined above IFF the lambda
608  // returns non-void.
609  (static_cast<Fn&&>(fn)(static_cast<This&&>(ex).value()), unit)),
610  static_cast<Fns&&>(fns)...);
611  }
612  return makeUnexpected(static_cast<This&&>(ex).error());
613  }
#define LIKELY(x)
Definition: Likely.h:47
requires And< SemiMovable< VN >... > &&SemiMovable< E > auto error(E e)
Definition: error.h:48
constexpr Unexpected< typename std::decay< Error >::type > makeUnexpected(Error &&)
Definition: Expected.h:785
constexpr Unit unit
Definition: Unit.h:45
uint64_t value(const typename LockFreeRingBuffer< T, Atom >::Cursor &rbcursor)
template<class This , class Yes , class No , class Ret = decltype(std::declval<Yes>()(std::declval<This>().value())), class Err = decltype(std::declval<No>()(std::declval<This>().error())), bool FB_CONCATENATE = false, typename std::enable_if< (FB_CONCATENATE(FB_CONCATENATE(Folly, Requires), __LINE__)||static_cast< bool >(!std::is_void< Err >::value)), int >::type = 0>
static Ret folly::expected_detail::expected_detail_ExpectedHelper::ExpectedHelper::thenOrThrow_ ( This &&  ex,
Yes &&  yes,
No &&  no 
)
inlinestatic

Definition at line 622 of file Expected.h.

References folly::pushmi::operators::error(), folly::expected_detail::eValue, FOLLY_REQUIRES_TRAILING, LIKELY, fizz::server::detail::No, folly::throw_exception(), value, folly::value(), and fizz::server::detail::Yes.

622  {
623  if (LIKELY(ex.which_ == expected_detail::Which::eValue)) {
624  return Ret(static_cast<Yes&&>(yes)(static_cast<This&&>(ex).value()));
625  }
626  throw_exception(static_cast<No&&>(no)(static_cast<This&&>(ex).error()));
627  }
#define LIKELY(x)
Definition: Likely.h:47
requires And< SemiMovable< VN >... > &&SemiMovable< E > auto error(E e)
Definition: error.h:48
uint64_t value(const typename LockFreeRingBuffer< T, Atom >::Cursor &rbcursor)
FOLLY_NOINLINE FOLLY_COLD void throw_exception(Ex &&ex)
Definition: Exception.h:32
template<class This , class Yes , class No , class Ret = decltype(std::declval<Yes>()(std::declval<This>().value())), class Err = decltype(std::declval<No>()(std::declval<This&>().error())), bool FB_CONCATENATE = false, typename std::enable_if< (FB_CONCATENATE(FB_CONCATENATE(Folly, Requires), __LINE__)||static_cast< bool >(std::is_void< Err >::value)), int >::type = 0>
static Ret folly::expected_detail::expected_detail_ExpectedHelper::ExpectedHelper::thenOrThrow_ ( This &&  ex,
Yes &&  yes,
No &&  no 
)
inlinestatic

Definition at line 636 of file Expected.h.

References folly::pushmi::operators::error(), folly::expected_detail::eValue, FOLLY_POP_WARNING, LIKELY, folly::throw_exception(), and folly::value().

636  {
637  if (LIKELY(ex.which_ == expected_detail::Which::eValue)) {
638  return Ret(static_cast<Yes&&>(yes)(static_cast<This&&>(ex).value()));
639  }
640  static_cast<No&&>(no)(ex.error());
641  typename Unexpected<ExpectedErrorType<This>>::MakeBadExpectedAccess bad;
642  throw_exception(bad(static_cast<This&&>(ex).error()));
643  }
#define LIKELY(x)
Definition: Likely.h:47
requires And< SemiMovable< VN >... > &&SemiMovable< E > auto error(E e)
Definition: error.h:48
uint64_t value(const typename LockFreeRingBuffer< T, Atom >::Cursor &rbcursor)
FOLLY_NOINLINE FOLLY_COLD void throw_exception(Ex &&ex)
Definition: Exception.h:32

The documentation for this struct was generated from the following file: