GCC Code Coverage Report


Directory: libs/beast2/
File: include/boost/beast2/client.hpp
Date: 2025-11-13 15:50:44
Exec Total Coverage
Lines: 3 3 100.0%
Functions: 1 1 100.0%
Branches: 0 0 -%

Line Branch Exec Source
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/beast2
8 //
9
10 #ifndef BOOST_BEAST2_CLIENT_HPP
11 #define BOOST_BEAST2_CLIENT_HPP
12
13 #include <boost/beast2/detail/config.hpp>
14 #include <type_traits>
15 #include <utility>
16
17 namespace boost {
18 namespace beast2 {
19
20 template<
21 class AsyncStream
22 /*,class Derived*/ // VFALCO CRTP for things like shutdown()
23 >
24 class client
25 {
26 public:
27 using stream_type = typename
28 std::remove_reference<AsyncStream>::type;
29
30 using executor_type = decltype(
31 std::declval<stream_type&>().get_executor());
32
33 template<
34 class... Args,
35 class = std::enable_if<
36 std::is_constructible<
37 AsyncStream, Args...>::value>
38 >
39 explicit
40 1 client(
41 Args&&... args) noexcept(
42 std::is_nothrow_constructible<
43 AsyncStream, Args...>::value)
44 1 : stream_(std::forward<Args>(args)...)
45 {
46 1 }
47
48 stream_type const&
49 stream() const noexcept
50 {
51 return stream_;
52 }
53
54 stream_type&
55 stream() noexcept
56 {
57 return stream_;
58 }
59
60 executor_type
61 get_executor() const
62 {
63 return stream_.get_executor();
64 }
65
66 private:
67 AsyncStream stream_;
68 };
69
70 } // beast2
71 } // boost
72
73 #endif
74