Skip to content

std.Io: delete CountingWriter - #24742

Merged
andrewrk merged 4 commits into
masterfrom
CountingWriter
Aug 8, 2025
Merged

andrewrk merged 4 commits into
masterfrom
CountingWriter

Conversation

@andrewrk

@andrewrk andrewrk commented Aug 8, 2025 •

Copy link
Copy Markdown
Member

Upgrade Guide:

  • If you were discarding the bytes, use std.Io.Writer.Discarding, which has a count.
  • If you were allocating the bytes, use std.Io.Writer.Allocating, since you can check how much was allocated.
  • If you were writing to a fixed buffer, use std.Io.Writer.fixed, and then check the end position.
  • Otherwise, try not to create an entire node in the stream graph solely for counting bytes. It's very disruptive to optimal buffering.

Note: the "random patches from another branch" commits are there in case someone wants to recover that code which was written earlier but bitrotted.

@andrewrk andrewrk added breaking Implementing this issue could cause existing code to no longer compile or have different behavior. standard library This issue involves writing Zig code for the standard library. release notes This PR should be mentioned in the release notes. labels Aug 8, 2025
@andrewrk
andrewrk merged commit d2f7792 into master Aug 8, 2025
@andrewrk
andrewrk deleted the CountingWriter branch August 8, 2025 19:30
@alexrp alexrp removed the release notes This PR should be mentioned in the release notes. label Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Implementing this issue could cause existing code to no longer compile or have different behavior. standard library This issue involves writing Zig code for the standard library.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants