Skip to content

docs: state that buffers do not own the bytes they refer to - #493

Merged
sgerbino merged 1 commit into
cppalliance:developfrom
sgerbino:pr/buffer-lifetime-docs
Nov 23, 2026
Merged

sgerbino merged 1 commit into
cppalliance:developfrom
sgerbino:pr/buffer-lifetime-docs

Conversation

@sgerbino

@sgerbino sgerbino commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Resolves discussion #433.

The review asked whether const_buffer, mutable_buffer and make_buffer should be renamed, because "buffer" reads as the memory itself rather than a view of it. The names stay, matching Asio, and the documentation now says plainly what they are: a buffer is a non-owning handle, a pointer and a size, and the bytes it refers to must stay valid until every operation using it completes.

The glossary defined a buffer as "a contiguous region of memory", the reading the review objected to. It now calls it a non-owning handle and links to Lifetime Management. The buffer section's introduction compares a buffer to std::string_view. Lifetime Management adds that a buffer never owns, allocates or copies its bytes, and that the storage must outlive the operation, not only the call that started it. The make_buffer section says it neither allocates nor copies, and that a buffer made from a temporary dangles once the full-expression that created the temporary ends. The composite buffer page says a range of buffers owns the pointers and sizes, not the bytes. The read_some and write_some descriptions say the storage must stay valid until the coroutine resumes. The const_buffer and mutable_buffer reference docs carry the same rule.

The docs lint gate reports no new findings.

Summary by CodeRabbit

  • Documentation
    • Clarified that buffers do not own or copy the referenced memory, and that it must remain valid until operations using it are complete.

The glossary defined a buffer as a region of memory, which invites
reading a buffer as the storage itself. Say throughout the buffer and
stream pages, the glossary, and the buffer type reference that a buffer
is a non-owning handle whose bytes must stay valid until every
operation using it completes.
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The mutable_buffer and const_buffer documentation now explains that buffers do not own or copy referenced memory. It also states that the memory must remain valid until operations using it complete.

Changes: Buffer Documentation

Layer / File(s) Summary
Buffer ownership and lifetime documentation
include/boost/capy/buffers.hpp
The mutable_buffer and const_buffer documentation describes allocation, copying, and memory-lifetime requirements. It also retains their sequence and conversion descriptions.

Estimated code review effort: 1 (Trivial) | ~4 minutes

Change: Other

Possibly related issues

  • cppalliance/capy#416: The buffer documentation updates cover part of the glossary review condition described by this tracker.

Suggested reviewers: vinniefalco

Merge Risk: Minimal · up to 33a0c · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "docs: state that buffers do not own the bytes they refer to" matches the main change. The raw summary says the mutable_buffer and const_buffer documentation now states that buffers do not o…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "docs: state that buffers do not own the bytes they refer to" matches the main change. The raw summary says the mutable_buffer and const_buffer documentation now states that buffers do not own, allocate, or copy the referenced memory. The PR objectives confirm the focus on buffers as non-owning handles, with lifetime rules added across the docs. The title is specific and concise, and it follows a conventional docs: prefix. Minor note: the title's 12 words and 59 characters are acceptable.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit reads the buffer page,
No memory travels in its cage.
The pointer and size stay clear,
Keep referenced memory near.
When operations finish their run,
The rabbit hops beneath the sun.

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 6a95690 and 33a0c6b.

Files ignored due to path filters: 5

  • doc/modules/ROOT/pages/5.buffers/5.intro.adoc is excluded by !**/doc/**
  • doc/modules/ROOT/pages/5.buffers/5a.contiguous-buffers.adoc is excluded by !**/doc/**
  • doc/modules/ROOT/pages/5.buffers/5b.composite-buffers.adoc is excluded by !**/doc/**
  • doc/modules/ROOT/pages/6.streams/6a.concepts.adoc is excluded by !**/doc/**
  • doc/modules/ROOT/pages/glossary.adoc is excluded by !**/doc/**
Files selected for processing: 1

  • include/boost/capy/buffers.hpp

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://493.capy.prtest3.cppalliance.org/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2026-11-23 14:51:33 UTC

@cppalliance-bot

Copy link
Copy Markdown

GCOVR code coverage report https://493.capy.prtest3.cppalliance.org/gcovr/index.html
LCOV code coverage report https://493.capy.prtest3.cppalliance.org/genhtml/index.html
Coverage Diff Report https://493.capy.prtest3.cppalliance.org/diff-report/index.html

Build time: 2026-11-23 15:05:47 UTC

@codecov

codecov Bot commented Nov 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.49%. Comparing base (6a95690) to head (33a0c6b).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #493   +/-   ##
========================================
  Coverage    98.49%   98.49%           
========================================
  Files          135      135           
  Lines         7364     7364           
========================================
  Hits          7253     7253           
  Misses         111      111           
Flag Coverage Δ
linux 98.48% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
include/boost/capy/buffers.hpp 100.00% <ø> (ø)

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6a95690...33a0c6b. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sgerbino
sgerbino merged commit 07ecb34 into cppalliance:develop Nov 23, 2026
111 of 116 checks passed
@sgerbino
sgerbino deleted the pr/buffer-lifetime-docs branch November 23, 2026 19:55
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Beast2 Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants