| ... | @@ -325,6 +325,12 @@ pub const Node = struct { | ... | @@ -325,6 +325,12 @@ pub const Node = struct { |
| 325 | return init(@enumFromInt(free_index), parent, name, estimated_total_items); | 325 | return init(@enumFromInt(free_index), parent, name, estimated_total_items); |
| 326 | } | 326 | } |
| 327 | | 327 | |
| | 328 | pub fn startFmt(node: Node, estimated_total_items: usize, comptime format: []const u8, args: anytype) Node { |
| | 329 | var buffer: [max_name_len]u8 = undefined; |
| | 330 | const name = std.fmt.bufPrint(&buffer, format, args) catch &buffer; |
| | 331 | return Node.start(node, name, estimated_total_items); |
| | 332 | } |
| | 333 | |
| 328 | /// This is the same as calling `start` and then `end` on the returned `Node`. Thread-safe. | 334 | /// This is the same as calling `start` and then `end` on the returned `Node`. Thread-safe. |
| 329 | pub fn completeOne(n: Node) void { | 335 | pub fn completeOne(n: Node) void { |
| 330 | const index = n.index.unwrap() orelse return; | 336 | const index = n.index.unwrap() orelse return; |