mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-03-08 03:04:52 +01:00
std.Progress: add Node.startFmt
convenience method for starting a child node with a formatted string as a name.
This commit is contained in:
parent
ee21a1f988
commit
7246eee1e7
1 changed files with 6 additions and 0 deletions
|
|
@ -325,6 +325,12 @@ pub const Node = struct {
|
|||
return init(@enumFromInt(free_index), parent, name, estimated_total_items);
|
||||
}
|
||||
|
||||
pub fn startFmt(node: Node, estimated_total_items: usize, comptime format: []const u8, args: anytype) Node {
|
||||
var buffer: [max_name_len]u8 = undefined;
|
||||
const name = std.fmt.bufPrint(&buffer, format, args) catch &buffer;
|
||||
return Node.start(node, name, estimated_total_items);
|
||||
}
|
||||
|
||||
/// This is the same as calling `start` and then `end` on the returned `Node`. Thread-safe.
|
||||
pub fn completeOne(n: Node) void {
|
||||
const index = n.index.unwrap() orelse return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue