proxygen
folly::coro::detail::ViaCoroutine Class Reference

#include <ViaIfAsync.h>

Classes

class  promise_type
 

Public Member Functions

 ViaCoroutine (ViaCoroutine &&other) noexcept
 
 ~ViaCoroutine ()
 
ViaCoroutineoperator= (ViaCoroutine other) noexcept
 
void swap (ViaCoroutine &other) noexcept
 
std::experimental::coroutine_handle getWrappedCoroutine (std::experimental::coroutine_handle<> continuation) noexcept
 
void destroy ()
 

Static Public Member Functions

static ViaCoroutine create (folly::Executor *executor)
 
static ViaCoroutine createInline () noexcept
 

Private Member Functions

 ViaCoroutine (std::experimental::coroutine_handle< promise_type > coro) noexcept
 

Private Attributes

std::experimental::coroutine_handle< promise_typecoro_
 

Friends

class promise_type
 

Detailed Description

Definition at line 34 of file ViaIfAsync.h.

Constructor & Destructor Documentation

folly::coro::detail::ViaCoroutine::ViaCoroutine ( ViaCoroutine &&  other)
inlinenoexcept

Definition at line 84 of file ViaIfAsync.h.

85  : coro_(std::exchange(other.coro_, {})) {}
std::experimental::coroutine_handle< promise_type > coro_
Definition: ViaIfAsync.h:131
T exchange(T &obj, U &&new_value)
Definition: Utility.h:120
folly::coro::detail::ViaCoroutine::~ViaCoroutine ( )
inline

Definition at line 87 of file ViaIfAsync.h.

References destroy().

87  {
88  destroy();
89  }
folly::coro::detail::ViaCoroutine::ViaCoroutine ( std::experimental::coroutine_handle< promise_type coro)
inlineexplicitprivatenoexcept

Definition at line 127 of file ViaIfAsync.h.

129  : coro_(coro) {}
std::experimental::coroutine_handle< promise_type > coro_
Definition: ViaIfAsync.h:131

Member Function Documentation

static ViaCoroutine folly::coro::detail::ViaCoroutine::create ( folly::Executor executor)
inlinestatic

Definition at line 116 of file ViaIfAsync.h.

116  {
117  co_return;
118  }
static ViaCoroutine folly::coro::detail::ViaCoroutine::createInline ( )
inlinestaticnoexcept

Definition at line 120 of file ViaIfAsync.h.

120  {
121  return ViaCoroutine{std::experimental::coroutine_handle<promise_type>{}};
122  }
ViaCoroutine(ViaCoroutine &&other) noexcept
Definition: ViaIfAsync.h:84
void folly::coro::detail::ViaCoroutine::destroy ( )
inline

Definition at line 110 of file ViaIfAsync.h.

References coro_, and folly::exchange().

Referenced by ~ViaCoroutine().

110  {
111  if (coro_) {
112  std::exchange(coro_, {}).destroy();
113  }
114  }
std::experimental::coroutine_handle< promise_type > coro_
Definition: ViaIfAsync.h:131
T exchange(T &obj, U &&new_value)
Definition: Utility.h:120
std::experimental::coroutine_handle folly::coro::detail::ViaCoroutine::getWrappedCoroutine ( std::experimental::coroutine_handle<>  continuation)
inlinenoexcept

Definition at line 100 of file ViaIfAsync.h.

References coro_.

101  {
102  if (coro_) {
103  coro_.promise().setContinuation(continuation);
104  return coro_;
105  } else {
106  return continuation;
107  }
108  }
std::experimental::coroutine_handle< promise_type > coro_
Definition: ViaIfAsync.h:131
ViaCoroutine& folly::coro::detail::ViaCoroutine::operator= ( ViaCoroutine  other)
inlinenoexcept

Definition at line 91 of file ViaIfAsync.h.

References swap().

91  {
92  swap(other);
93  return *this;
94  }
void swap(ViaCoroutine &other) noexcept
Definition: ViaIfAsync.h:96
void folly::coro::detail::ViaCoroutine::swap ( ViaCoroutine other)
inlinenoexcept

Definition at line 96 of file ViaIfAsync.h.

References coro_, and folly::f14::swap().

Referenced by operator=().

96  {
97  std::swap(coro_, other.coro_);
98  }
std::experimental::coroutine_handle< promise_type > coro_
Definition: ViaIfAsync.h:131
void swap(SwapTrackingAlloc< T > &, SwapTrackingAlloc< T > &)
Definition: F14TestUtil.h:414

Friends And Related Function Documentation

friend class promise_type
friend

Definition at line 125 of file ViaIfAsync.h.

Member Data Documentation

std::experimental::coroutine_handle<promise_type> folly::coro::detail::ViaCoroutine::coro_
private

Definition at line 131 of file ViaIfAsync.h.

Referenced by destroy(), getWrappedCoroutine(), and swap().


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