authorgravatar for r00ster91@proton.meWooster <r00ster91@proton.me> 2022-10-13 14:45:35+02:00
committergravatar for r00ster91@proton.meWooster <r00ster91@proton.me> 2022-10-13 16:06:46+02:00
loge484e759698f3bbcf0d92f94a6addc9eea4afc73
treea1c05bf2b2e7b3d7fc039cb93a07b12c8e3ea41b
parentea23217751c474140c7b46cbffa796a2f93f3ffb

docs: add notes


1 files changed, 8 insertions(+), 2 deletions(-)

lib/std/Progress.zig+8-2
...@@ -57,6 +57,8 @@ output_buffer_slice: []u8 = undefined,...@@ -57,6 +57,8 @@ output_buffer_slice: []u8 = undefined,
57///57///
58/// It is recommended to leave this as `null` so that `start` can automatically decide an58/// It is recommended to leave this as `null` so that `start` can automatically decide an
59/// optimal width for the terminal.59/// optimal width for the terminal.
60///
61/// Note that this will be clamped to at least 4 and output will appear malformed if it is < 4.
60max_width: ?usize = null,62max_width: ?usize = null,
6163
62/// How many nanoseconds between writing updates to the terminal.64/// How many nanoseconds between writing updates to the terminal.
...@@ -156,9 +158,13 @@ pub const Node = struct {...@@ -156,9 +158,13 @@ pub const Node = struct {
156158
157/// Create a new progress node.159/// Create a new progress node.
158/// Call `Node.end` when done.160/// Call `Node.end` when done.
159/// TODO solve https://github.com/ziglang/zig/issues/2765 and then change this
160/// API to return Progress rather than accept it as a parameter.
161/// `estimated_total_items` value of 0 means unknown.161/// `estimated_total_items` value of 0 means unknown.
162///
163/// Note that as soon as work is started and progress output is printed,
164/// `std.Progress` expects you to lean back and wait and not resize the terminal.
165/// Resizing the terminal during progress output may result in malformed output.
166// TODO: solve https://github.com/ziglang/zig/issues/2765 and then change this
167// API to return Progress rather than accept it as a parameter.
162pub fn start(self: *Progress, name: []const u8, estimated_total_items: usize) *Node {168pub fn start(self: *Progress, name: []const u8, estimated_total_items: usize) *Node {
163 const stderr = std.io.getStdErr();169 const stderr = std.io.getStdErr();
164 self.terminal = null;170 self.terminal = null;