Function bufPrint [src]

Print a format string into buf. Returns a slice of the bytes printed.

Prototype

pub fn bufPrint(buf: []u8, comptime fmt: []const u8, args: anytype) BufPrintError![]u8

Parameters

buf: []u8fmt: []const u8

Possible Errors

NoSpaceLeft

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

Source

pub fn bufPrint(buf: []u8, comptime fmt: []const u8, args: anytype) BufPrintError![]u8 { var w: Writer = .fixed(buf); w.print(fmt, args) catch |err| switch (err) { error.WriteFailed => return error.NoSpaceLeft, }; return w.buffered(); }