Represents one unit of progress. Each node can have children nodes, or one can use integers with update.

Fields

context: *Progress,
parent: ?*Node,
name: []const u8,
unit: []const u8 = "",
recently_updated_child: ?*Node = null,

Must be handled atomically to be thread-safe.

unprotected_estimated_total_items: usize,

Must be handled atomically to be thread-safe. 0 means null.

unprotected_completed_items: usize,

Must be handled atomically to be thread-safe.

Functions

fn activate(self: *Node) void

Tell the parent node that this node is actively being worked on. Thread-safe.

fn completeOne(self: *Node) void

This is the same as calling start and then end on the returned Node. Threa…

This is the same as calling start and then end on the returned Node. Thread-safe.

fn end(self: *Node) void

Finish a started Node. Thread-safe.

fn setCompletedItems(self: *Node, completed_items: usize) void

Thread-safe.

fn setEstimatedTotalItems(self: *Node, count: usize) void

Thread-safe. 0 means unknown.

fn setName(self: *Node, name: []const u8) void

Thread-safe.

fn setUnit(self: *Node, unit: []const u8) void

Thread-safe.

fn start(self: *Node, name: []const u8, estimated_total_items: usize) Node

Create a new child progress node. Thread-safe. Call Node.end when done. TODO…

Create a new child progress node. Thread-safe. Call Node.end when done. TODO solve https://github.com/ziglang/zig/issues/2765 and then change this API to set self.parent.recently_updated_child with the return value. Until that is fixed you probably want to call activate on the return value. Passing 0 for estimated_total_items means unknown.