Next video: show fmt.bufPrint.
This commit is contained in:
parent
d26d6de759
commit
9d875062f6
@ -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.
|
||||||
|
Reference in New Issue
Block a user