aboutsummaryrefslogtreecommitdiff
path: root/lib/std/fmt.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2025-07-08 17:33:02 -0700
committerAndrew Kelley <andrew@ziglang.org>2025-07-09 09:32:07 -0700
commitbc2cf0c173465f4e3ac60fe2907dfedd2eebf8eb (patch)
tree7a404dc11967aa7d552f9fd727477257dd49ad03 /lib/std/fmt.zig
parentd345a10054caa78d6e697089b0b3ca5b540b2d9c (diff)
downloadzig-bc2cf0c173465f4e3ac60fe2907dfedd2eebf8eb.tar.gz
zig-bc2cf0c173465f4e3ac60fe2907dfedd2eebf8eb.zip
eliminate all uses of std.io.Writer.count except for CBE
Diffstat (limited to 'lib/std/fmt.zig')
-rw-r--r--lib/std/fmt.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/std/fmt.zig b/lib/std/fmt.zig
index 56780c8593..aa6b5c1670 100644
--- a/lib/std/fmt.zig
+++ b/lib/std/fmt.zig
@@ -772,11 +772,11 @@ pub fn bufPrintZ(buf: []u8, comptime fmt: []const u8, args: anytype) BufPrintErr
/// Count the characters needed for format.
pub fn count(comptime fmt: []const u8, args: anytype) usize {
var trash_buffer: [64]u8 = undefined;
- var w: Writer = .discarding(&trash_buffer);
- w.print(fmt, args) catch |err| switch (err) {
+ var dw: Writer.Discarding = .init(&trash_buffer);
+ dw.writer.print(fmt, args) catch |err| switch (err) {
error.WriteFailed => unreachable,
};
- return w.count;
+ return @intCast(dw.count + dw.writer.end);
}
pub fn allocPrint(gpa: Allocator, comptime fmt: []const u8, args: anytype) Allocator.Error![]u8 {