Line data Source code
1 : //
2 : // Copyright (c) 2025 Mohammad Nejati
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/http_proto
8 : //
9 :
10 : #ifndef BOOST_HTTP_PROTO_DETAIL_BUFFER_UTILS_HPP
11 : #define BOOST_HTTP_PROTO_DETAIL_BUFFER_UTILS_HPP
12 :
13 : #include <boost/buffers/buffer.hpp>
14 : #include <boost/buffers/slice.hpp>
15 : #include <boost/core/span.hpp>
16 :
17 : namespace boost {
18 : namespace http_proto {
19 : namespace detail {
20 :
21 : template<
22 : typename BufferSequence,
23 : typename Buffer = typename BufferSequence::value_type>
24 : boost::span<Buffer const>
25 126757 : make_span(BufferSequence const& mbp)
26 : {
27 126757 : return { mbp.begin(), mbp.end() };
28 : }
29 :
30 : template<typename BufferSequence>
31 : BufferSequence
32 144239 : prefix(
33 : BufferSequence cbp,
34 : std::size_t n)
35 : {
36 144239 : buffers::keep_front(cbp, n);
37 144239 : return cbp;
38 : }
39 :
40 : } // detail
41 : } // http_proto
42 : } // boost
43 :
44 : #endif
|