Function allocPrintSentinel [src]
Prototype
pub fn allocPrintSentinel( gpa: Allocator, comptime fmt: []const u8, args: anytype, comptime sentinel: u8, ) Allocator.Error![:sentinel]u8 Parameters
gpa: Allocatorfmt: []const u8sentinel: u8 Source
pub fn allocPrintSentinel(
gpa: Allocator,
comptime fmt: []const u8,
args: anytype,
comptime sentinel: u8,
) Allocator.Error![:sentinel]u8 {
var aw = try Writer.Allocating.initCapacity(gpa, fmt.len);
defer aw.deinit();
aw.writer.print(fmt, args) catch |err| switch (err) {
error.WriteFailed => return error.OutOfMemory,
};
return aw.toOwnedSliceSentinel(sentinel);
}