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 {...@@ -584,36 +584,41 @@ pub fn writeAll(w: *Writer, bytes: []const u8) Error!void {
584/// required, otherwise the digit following ':' is interpreted as **width**.584/// required, otherwise the digit following ':' is interpreted as **width**.
585///585///
586/// **specifier** supports:586/// **specifier** supports:
587/// - `x` and `X`: numeric value in hexadecimal notation, or string in hexadecimal bytes587/// - "x" and "X": numeric value in hexadecimal notation, or string in hexadecimal bytes
588/// - `s`:588/// - "s":
589/// - for pointer-to-many and C pointers of u8, print as a C-string using zero-termination589/// - for pointer-to-many and C pointers of u8, print as a C-string using zero-termination
590/// - for slices of u8, print the entire slice as a string without zero-termination590/// - for slices of u8, print the entire slice as a string without zero-termination
591/// - `t`:591/// - "t":
592/// - for enums and tagged unions: prints the tag name592/// - for enums and tagged unions: prints the tag name
593/// - for error sets: prints the error name593/// - for error sets: prints the error name
594/// - `b64`: string as standard base64594/// - "b64": string as standard base64
595/// - `e`: floating point value in scientific notation595/// - "e": floating point value in scientific notation
596/// - `d`: numeric value in decimal notation596/// - "d": numeric value in decimal notation
597/// - `b`: integer value in binary notation597/// - "b": integer value in binary notation
598/// - `o`: integer value in octal notation598/// - "o": integer value in octal notation
599/// - `c`: integer as an ASCII character. Integer type must have 8 bits at max.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.600/// - "u": integer as an UTF-8 sequence. Integer type must have 21 bits at max.
601/// - `B`: bytes in SI units (decimal)601/// - "B": bytes in SI units (decimal)
602/// - `Bi`: bytes in IEC units (binary)602/// - "Bi": bytes in IEC units (binary)
603/// - `?`: optional value as either the unwrapped value, or `null`; may be603/// - "?": optional value as either the unwrapped value, or `null`; may be
604/// followed by a format specifier for the underlying value.604/// followed by a format specifier for the underlying value.
605/// - `!`: error union value as either the unwrapped value, or the formatted605/// - "!": error union value as either the unwrapped value, or the formatted
606/// error value; may be followed by a format specifier for the underlying606/// error value; may be followed by a format specifier for the underlying
607/// value.607/// value.
608/// - `*`: the address of the value instead of the value itself.608/// - "*": the address of the value instead of the value itself.
609/// - `any`: a value of any type using its default format.609/// - "any": a value of any type using its default format.
610/// - `f`: delegates to the `format` method of the type, passing `*Writer` and610/// - "f": delegates to the `format` method of the type, passing `*Writer` and
611/// expecting `Error!void` returned.611/// expecting `Error!void` returned.
612///612/// - "q": prints as a double-quote escaped string. Inside the double-quoted
613/// A user type may be a struct, vector, union or enum type.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.
614///619///
615/// Literal curly braces can be escaped in the format string via doubling, e.g.620/// Literal curly braces can be escaped in the format string via doubling, e.g.
616/// `{{` or `}}`.621/// "{{" or "}}".
617pub fn print(w: *Writer, comptime fmt: []const u8, args: anytype) Error!void {622pub fn print(w: *Writer, comptime fmt: []const u8, args: anytype) Error!void {
618 const ArgsType = @TypeOf(args);623 const ArgsType = @TypeOf(args);
619 const args_type_info = @typeInfo(ArgsType);624 const args_type_info = @typeInfo(ArgsType);