LCOV - code coverage report
Current view: top level - capy/detail - await_suspend_helper.hpp (source / functions) Coverage Total Hit
Test: coverage_filtered.info Lines: 0.0 % 3 0
Test Date: 2026-02-01 07:03:35 Functions: 0.0 % 10 0

            Line data    Source code
       1              : //
       2              : // Copyright (c) 2025 Vinnie Falco (vinnie dot falco at gmail dot com)
       3              : //
       4              : // Distributed under the Boost Software License, Version 1.0. (See accompanying
       5              : // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       6              : //
       7              : // Official repository: https://github.com/cppalliance/capy
       8              : //
       9              : 
      10              : #ifndef BOOST_CAPY_DETAIL_AWAIT_SUSPEND_HELPER_HPP
      11              : #define BOOST_CAPY_DETAIL_AWAIT_SUSPEND_HELPER_HPP
      12              : 
      13              : #include <boost/capy/coro.hpp>
      14              : #include <boost/capy/ex/executor_ref.hpp>
      15              : 
      16              : #include <stop_token>
      17              : #include <type_traits>
      18              : 
      19              : namespace boost {
      20              : namespace capy {
      21              : namespace detail {
      22              : 
      23              : // Helper to normalize await_suspend return types to coro
      24              : template<typename Awaitable>
      25            0 : coro call_await_suspend(
      26              :     Awaitable* a,
      27              :     coro h,
      28              :     executor_ref ex,
      29              :     std::stop_token token)
      30              : {
      31              :     using R = decltype(a->await_suspend(h, ex, token));
      32              :     if constexpr (std::is_void_v<R>)
      33              :     {
      34            0 :         a->await_suspend(h, ex, token);
      35            0 :         return std::noop_coroutine();
      36              :     }
      37              :     else if constexpr (std::is_same_v<R, bool>)
      38              :     {
      39              :         if(a->await_suspend(h, ex, token))
      40              :             return std::noop_coroutine();
      41              :         return h;
      42              :     }
      43              :     else
      44              :     {
      45              :         return a->await_suspend(h, ex, token);
      46              :     }
      47              : }
      48              : 
      49              : } // namespace detail
      50              : } // namespace capy
      51              : } // namespace boost
      52              : 
      53              : #endif
        

Generated by: LCOV version 2.3