To use this library with C++20 coroutine the call in handle_error.hpp - try_handle_all or try_handle_some:
if( auto r = std::forward<TryBlock>(try_block)() )
Should check whether the returned time is an Awaitable and use
if( auto r = co_await std::forward<TryBlock>(try_block)() )
instead. Similarly for the error handling functions. This would allow users to write code among the lines of:
boost:leaf::try_handle_some(
[]() -> boost::asio::awaitable<boost:leaf::result<void>> {
co_return boost::leaf::result<void>{};
}, ...);
which is currently not possible. Maybe we could even achieve less verbosity. Ideally I would want to write co_return {}; just like before, but I think boost::leaf::result<> would need a constructor that takes an initializer_list then.
To use this library with C++20 coroutine the call in
handle_error.hpp-try_handle_allortry_handle_some:if( auto r = std::forward<TryBlock>(try_block)() )Should check whether the returned time is an Awaitable and use
if( auto r = co_await std::forward<TryBlock>(try_block)() )instead. Similarly for the error handling functions. This would allow users to write code among the lines of:
boost:leaf::try_handle_some( []() -> boost::asio::awaitable<boost:leaf::result<void>> { co_return boost::leaf::result<void>{}; }, ...);which is currently not possible. Maybe we could even achieve less verbosity. Ideally I would want to write
co_return {};just like before, but I thinkboost::leaf::result<>would need a constructor that takes aninitializer_listthen.