Skip to content

feat: add read_at_least and write_at_least algorithms (#260)#347

Merged
mvandeberg merged 1 commit into
cppalliance:develop-2from
mvandeberg:pr/260-read-write-at-least
Jul 1, 2026
Merged

feat: add read_at_least and write_at_least algorithms (#260)#347
mvandeberg merged 1 commit into
cppalliance:develop-2from
mvandeberg:pr/260-read-write-at-least

Conversation

@mvandeberg

Copy link
Copy Markdown
Contributor

Add read_at_least and write_at_least as straightforward extensions of read/write. Where read/write transfer exactly buffer_size(buffers) bytes, the _at_least variants stop as soon as a minimum of n bytes have been transferred, keeping any bytes a single read_some/write_some delivers beyond n without looping again. This serves the buffered-source case where n bytes are required but the remaining buffer capacity is optional.

If n exceeds buffer_size(buffers) the request is impossible to satisfy and the operation fails immediately with {std::errc::invalid_argument, 0}. A contingency that coincides with reaching n is suppressed: a satisfied request is a success, mirroring read/write.

Add read_at_least and write_at_least as straightforward extensions of
read/write. Where read/write transfer exactly buffer_size(buffers) bytes,
the _at_least variants stop as soon as a minimum of n bytes have been
transferred, keeping any bytes a single read_some/write_some delivers
beyond n without looping again. This serves the buffered-source case
where n bytes are required but the remaining buffer capacity is optional.

If n exceeds buffer_size(buffers) the request is impossible to satisfy and
the operation fails immediately with {std::errc::invalid_argument, 0}.
A contingency that coincides with reaching n is suppressed: a satisfied
request is a success, mirroring read/write.
@cppalliance-bot

Copy link
Copy Markdown

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

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

2026-07-01 18:23:06 UTC

@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.29%. Comparing base (fa088fb) to head (69cd99b).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           develop-2     #347   +/-   ##
==========================================
  Coverage      98.29%   98.29%           
==========================================
  Files             77       79    +2     
  Lines           3984     3986    +2     
==========================================
+ Hits            3916     3918    +2     
  Misses            68       68           
Flag Coverage Δ
linux 98.29% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 2 files 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 fa088fb...69cd99b. Read the comment docs.

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

@mvandeberg mvandeberg merged commit 6859f5f into cppalliance:develop-2 Jul 1, 2026
38 checks passed
@mvandeberg mvandeberg deleted the pr/260-read-write-at-least branch July 1, 2026 20:47
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Beast2 Jul 1, 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