Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Function

count

Public Function
std.fmt.count
pub fn count(comptime fmt: []const u8, args: anytype) usize

Count the characters needed for format.

Params

  • fmt: []const u8
  • args

File

fmt.zig:615
615
616
617
618
619
620
621
622
pub fn count(comptime fmt: []const u8, args: anytype) usize {
    var trash_buffer: [64]u8 = undefined;
    var dw: Writer.Discarding = .init(&trash_buffer);
    dw.writer.print(fmt, args) catch |err| switch (err) {
        error.WriteFailed => unreachable,
    };
    return @intCast(dw.count + dw.writer.end);
}