LCOV - code coverage report
Current view: top level - capy/asio/detail - asio_coroutine_unique_handle.hpp (source / functions) Coverage Total Hit Missed
Test: coverage_remapped.info Lines: 75.0 % 12 9 3
Test Date: 2026-05-01 02:54:45 Functions: 80.0 % 5 4 1

           TLA  Line data    Source code
       1                 : //
       2                 : // Copyright (c) 2026 Vinnie Falco (vinnie.falco@gmail.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                 : 
      11                 : #ifndef BOOST_CAPY_ASIO_DETAIL_ASIO_COROUTINE_UNIQUE_HANDLE
      12                 : #define BOOST_CAPY_ASIO_DETAIL_ASIO_COROUTINE_UNIQUE_HANDLE
      13                 : 
      14                 : #include <coroutine>
      15                 : #include <memory>
      16                 : 
      17                 : namespace boost::capy::detail 
      18                 : {
      19                 : 
      20                 : struct asio_coroutine_unique_handle
      21                 : {
      22                 :   struct deleter 
      23                 :   {
      24                 :     deleter() = default;
      25 MIS           0 :     void operator()(void * h) const
      26                 :     {
      27               0 :       std::coroutine_handle<void>::from_address(h).destroy();
      28               0 :     }
      29                 :   };
      30                 :   std::unique_ptr<void, deleter> handle;
      31                 : 
      32 HIT          11 :   asio_coroutine_unique_handle(
      33              11 :     std::coroutine_handle<void> h) : handle(h.address()) {}
      34                 : 
      35              40 :   asio_coroutine_unique_handle(
      36                 :       asio_coroutine_unique_handle &&
      37                 :       ) noexcept = default;
      38                 :       
      39               8 :   void operator()()
      40                 :   {    
      41               8 :     release().resume();
      42               8 :   }
      43                 : 
      44              11 :   std::coroutine_handle<> release()
      45                 :   {
      46              11 :     return std::coroutine_handle<void>::from_address(
      47                 :         handle.release()
      48              11 :         );
      49                 :   }
      50                 : };
      51                 : 
      52                 : }
      53                 : 
      54                 : #endif 
      55                 : 
        

Generated by: LCOV version 2.3