Allow awaiting on a folly::Optional that returns a move-only type
authorDylan Yudaken <dylany@fb.com>
Fri, 15 Sep 2017 17:13:16 +0000 (10:13 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 15 Sep 2017 17:21:55 +0000 (10:21 -0700)
commit3597c587da97b02466811339af1e9ced2e73d988
tree695142490c28a372ebffef81722aa6fcbffe48b2
parent481365efcd19b729e41400f442bcd19cb9ea1323
Allow awaiting on a folly::Optional that returns a move-only type

Summary:
await_resume is only called once, so this allows it to move the value out.
At the same time remove a redundant clear (but keep the existing requirement that the promise type is an OptionalPromise), and clean up the tests.
Also add a test to make sure the coroutine is cleaned up

Reviewed By: ericniebler

Differential Revision: D5834861

fbshipit-source-id: 7ad487e818969cdf6fe27c9e82931aa247daf4e4
folly/Optional.h
folly/test/OptionalCoroutinesTest.cpp