File indexing completed on 2026-08-17 08:39:19
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_COBALT_IO_READ_HPP
0009 #define BOOST_COBALT_IO_READ_HPP
0010
0011 #include <boost/cobalt/io/detail/config.hpp>
0012 #include <boost/cobalt/io/buffer.hpp>
0013 #include <boost/cobalt/io/ops.hpp>
0014
0015 #include <concepts>
0016
0017 namespace boost::cobalt::io
0018 {
0019
0020 struct BOOST_COBALT_IO_DECL read_all final : op<system::error_code, std::size_t>
0021 {
0022 read_op step;
0023 read_all(read_op op) : step(op) {}
0024 ~read_all() = default;
0025
0026 void initiate(completion_handler<system::error_code, std::size_t>) final;
0027 };
0028
0029 template<typename Stream>
0030 requires requires (Stream & str, mutable_buffer_sequence buffer)
0031 {
0032 {str.read_some(buffer)} -> std::same_as<read_op>;
0033 }
0034 [[nodiscard]] BOOST_COBALT_MSVC_NOINLINE
0035 read_all read(Stream & str, mutable_buffer_sequence buffer)
0036 {
0037 return read_all{str.read_some(buffer)};
0038 }
0039
0040
0041 struct BOOST_COBALT_IO_DECL read_all_at final : op<system::error_code, std::size_t>
0042 {
0043 read_at_op step;
0044 read_all_at(read_at_op op) : step(op) {}
0045 ~read_all_at() = default;
0046
0047 void initiate(completion_handler<system::error_code, std::size_t>) final;
0048 };
0049
0050 template<typename Stream>
0051 requires requires (Stream & str, std::uint64_t offset, mutable_buffer_sequence buffer)
0052 {
0053 {str.read_some_at(offset, buffer)} -> std::same_as<read_at_op>;
0054 }
0055 [[nodiscard]] BOOST_COBALT_MSVC_NOINLINE
0056 read_all_at read_at(Stream & str, std::uint64_t offset, mutable_buffer_sequence buffer)
0057 {
0058 return read_all_at{str.read_some_at(offset, buffer)};
0059 }
0060
0061
0062 }
0063
0064 #endif