File indexing completed on 2026-08-17 08:39:20
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_COBALT_IO_WRITE_HPP
0009 #define BOOST_COBALT_IO_WRITE_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 write_all final : op<system::error_code, std::size_t>
0021 {
0022 write_op step;
0023 write_all(write_op op) : step(op) {}
0024
0025 ~write_all() = default;
0026 void initiate(completion_handler<system::error_code, std::size_t>) final;
0027 };
0028
0029 template<typename Stream>
0030 requires requires (Stream & str, const_buffer_sequence buffer)
0031 {
0032 {str.write_some(buffer)} -> std::same_as<write_op>;
0033 }
0034 [[nodiscard]] BOOST_COBALT_MSVC_NOINLINE
0035 write_all write(Stream & str, const_buffer_sequence buffer)
0036 {
0037 return write_all{str.write_some(buffer)};
0038 }
0039
0040
0041 struct BOOST_COBALT_IO_DECL write_all_at final : op<system::error_code, std::size_t>
0042 {
0043 write_at_op step;
0044 write_all_at(write_at_op op) : step(op) {}
0045 ~write_all_at() = default;
0046 void initiate(completion_handler<system::error_code, std::size_t>) final;
0047 };
0048
0049 template<typename Stream>
0050 requires requires (Stream & str, std::uint64_t offset, const_buffer_sequence buffer)
0051 {
0052 {str.write_some_at(offset, buffer)} -> std::same_as<write_op>;
0053 }
0054 [[nodiscard]] BOOST_COBALT_MSVC_NOINLINE
0055 write_all_at write_at(Stream & str, std::uint64_t offset, const_buffer_sequence buffer)
0056 {
0057 return write_all_at{str.write_some_at(offset, buffer)};
0058 }
0059
0060
0061 }
0062
0063 #endif