Skip to content

Composed operations doc has wrong namespaces, signatures, and behavior #211

@sgerbino

Description

@sgerbino

Summary

The composed operations guide at doc/modules/ROOT/pages/4.guide/4g.composed-operations.adoc documents read() and write() with incorrect namespaces, include paths, signatures, and behavioral claims. These functions live in capy, not corosio.

Issues

1. Wrong namespace and include paths

The doc says:

#include <boost/corosio/read.hpp>
#include <boost/corosio/write.hpp>
co_await corosio::read(stream, buf);

Actual:

#include <boost/capy/read.hpp>
#include <boost/capy/write.hpp>
co_await capy::read(stream, buf);

2. Wrong read() into std::string signature

The doc shows:

std::string content;
co_await corosio::read(stream, content);

The actual overload takes a DynamicBufferParam, not a bare std::string:

std::string content;
co_await capy::read(stream, capy::string_dynamic_buffer(&content));

3. Wrong return type

The doc claims capy::task<io_result<std::size_t>>. The public alias is capy::io_task<std::size_t>.

4. capy::error::eof vs capy::cond::eof

The doc uses capy::error::eof in code examples. The actual implementation in read.hpp and user-facing code in io_stream.hpp/tcp_socket.hpp compare against capy::cond::eof (the error condition), which is the idiomatic pattern.

5. Incorrect write() zero-byte behavior claim

The doc states: "If write_some() returns 0 bytes, returns errc::broken_pipe". The actual write() implementation has no such check — it loops until done or an error propagates from write_some.

6. Wrong exception type

The doc uses boost::system::system_error. The actual code uses capy::detail::throw_system_error(ec).

7. Wrong template constraint syntax in signatures

The doc shows capy::mutable_buffer_sequence / capy::const_buffer_sequence (lowercase). The actual concepts are PascalCase (MutableBufferSequence, ConstBufferSequence) and the functions use terse syntax (ReadStream auto&, MutableBufferSequence auto const&).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions