Archived
3
0

Next video: show fmt.bufPrint.

This commit is contained in:
Philippe Pittoli 2023-02-15 15:56:14 +01:00
parent d26d6de759
commit 9d875062f6

View File

@ -56,6 +56,17 @@ Example:
try writer.print("{s}/{s}", .{ self.rundir, service_name }); try writer.print("{s}/{s}", .{ self.rundir, service_name });
} }
From
var buffer: [1000]u8 = undefined;
var fbs = std.io.fixedBufferStream(&buffer);
var writer = fbs.writer();
try ctx.server_path("simple-context-test", writer);
var path = fbs.getWritten();
To
var buffer: [1000]u8 = undefined;
var path = try std.fmt.bufPrint(&buffer, "{s}/{s}", .{ ctx.rundir, "simple-context-test" });
# Errors # Errors
Double returning type => no need for specific return structures. Double returning type => no need for specific return structures.