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

print

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

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.

Params

  • buffer: []u8
  • format: []const u8
  • args

Errors

NoSpaceLeft

As much as possible was written to the buffer, but it was too small to fit all the printed bytes.

File

mem.zig:5209
5209
5210
5211
5212
5213
5214
5215
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();
}