Zig 0.17.0-dev (Split by item)

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 library itself.

print

Render a formatted string into buffer. Returns a slice of buffer starting at index 0 containing the result, or error.NoSpaceLeft if one or more bytes were truncated.

See std.Io.Writer.print.

mem.print
pub fn print(buffer: []u8, comptime format: []const u8, args: anytype) PrintError![]u8

File

lib/std/mem.zig:5169

Code

pub fn print(buffer: []u8, comptime format: []const u8, args: anytype) PrintError![]u8 {
    var w: std.Io.Writer = .fixed(buffer);
    w.print(format, args) catch |err| switch (err) {
        error.WriteFailed => return error.NoSpaceLeft,
    };
    return w.buffered();
}