authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-08-20 16:27:49-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-08-20 17:35:12-07:00
log4c655f4672572c522fd41296e0fc8737847d1101
tree09313ca8919ef9ea78c5c68b95845776ae6c7f63
parent7e012b4f7c08e234b7e13cd7875a3a496dd80956

std.Io.Writer.print: update doc comments


1 files changed, 25 insertions(+), 20 deletions(-)

lib/std/Io/Writer.zig+25-20
......@@ -584,36 +584,41 @@ pub fn writeAll(w: *Writer, bytes: []const u8) Error!void {
584584/// required, otherwise the digit following ':' is interpreted as **width**.
585585///
586586/// **specifier** supports:
587/// - `x` and `X`: numeric value in hexadecimal notation, or string in hexadecimal bytes
588/// - `s`:
587/// - "x" and "X": numeric value in hexadecimal notation, or string in hexadecimal bytes
588/// - "s":
589589/// - for pointer-to-many and C pointers of u8, print as a C-string using zero-termination
590590/// - for slices of u8, print the entire slice as a string without zero-termination
591/// - `t`:
591/// - "t":
592592/// - for enums and tagged unions: prints the tag name
593593/// - for error sets: prints the error name
594/// - `b64`: string as standard base64
595/// - `e`: floating point value in scientific notation
596/// - `d`: numeric value in decimal notation
597/// - `b`: integer value in binary notation
598/// - `o`: integer value in octal notation
599/// - `c`: integer as an ASCII character. Integer type must have 8 bits at max.
600/// - `u`: integer as an UTF-8 sequence. Integer type must have 21 bits at max.
601/// - `B`: bytes in SI units (decimal)
602/// - `Bi`: bytes in IEC units (binary)
603/// - `?`: optional value as either the unwrapped value, or `null`; may be
594/// - "b64": string as standard base64
595/// - "e": floating point value in scientific notation
596/// - "d": numeric value in decimal notation
597/// - "b": integer value in binary notation
598/// - "o": integer value in octal notation
599/// - "c": integer as an ASCII character. Integer type must have 8 bits at max.
600/// - "u": integer as an UTF-8 sequence. Integer type must have 21 bits at max.
601/// - "B": bytes in SI units (decimal)
602/// - "Bi": bytes in IEC units (binary)
603/// - "?": optional value as either the unwrapped value, or `null`; may be
604604/// followed by a format specifier for the underlying value.
605/// - `!`: error union value as either the unwrapped value, or the formatted
605/// - "!": error union value as either the unwrapped value, or the formatted
606606/// error value; may be followed by a format specifier for the underlying
607607/// value.
608/// - `*`: the address of the value instead of the value itself.
609/// - `any`: a value of any type using its default format.
610/// - `f`: delegates to the `format` method of the type, passing `*Writer` and
608/// - "*": the address of the value instead of the value itself.
609/// - "any": a value of any type using its default format.
610/// - "f": delegates to the `format` method of the type, passing `*Writer` and
611611/// expecting `Error!void` returned.
612///
613/// A user type may be a struct, vector, union or enum type.
612/// - "q": prints as a double-quote escaped string. Inside the double-quoted
613/// string, everything is passed through unmodified, except for the following
614/// transformations:
615/// - escaped: '\n', '\r', '\t', '\\', '"'
616/// - hex-encoded: ASCII control characters
617/// - "qf": delegates to the `format` method of the type, while double-quote
618/// escaping.
614619///
615620/// Literal curly braces can be escaped in the format string via doubling, e.g.
616/// `{{` or `}}`.
621/// "{{" or "}}".
617622pub fn print(w: *Writer, comptime fmt: []const u8, args: anytype) Error!void {
618623 const ArgsType = @TypeOf(args);
619624 const args_type_info = @typeInfo(ArgsType);