authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-07-10 13:14:55-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-07-10 16:52:29-07:00
loge25541549852c8dcf4acbcc1a3f3d7ef4bcef9d7
tree249fe817a5250623e38f6e45d0fd5afc4a942a1c
parent88e50b30c3c929761f2ae1a924b96f8bc7548b84

std: add some missing doc comments


2 files changed, 14 insertions(+), 0 deletions(-)

lib/std/Io/Reader.zig+9
...@@ -840,6 +840,9 @@ pub fn peekDelimiterExclusive(r: *Reader, delimiter: u8) DelimiterError![]u8 {...@@ -840,6 +840,9 @@ pub fn peekDelimiterExclusive(r: *Reader, delimiter: u8) DelimiterError![]u8 {
840/// Returns number of bytes streamed, which may be zero, or error.EndOfStream840/// Returns number of bytes streamed, which may be zero, or error.EndOfStream
841/// if the delimiter was not found.841/// if the delimiter was not found.
842///842///
843/// Asserts buffer capacity of at least one. This function performs better with
844/// larger buffers.
845///
843/// See also:846/// See also:
844/// * `streamDelimiterEnding`847/// * `streamDelimiterEnding`
845/// * `streamDelimiterLimit`848/// * `streamDelimiterLimit`
...@@ -858,6 +861,9 @@ pub fn streamDelimiter(r: *Reader, w: *Writer, delimiter: u8) StreamError!usize...@@ -858,6 +861,9 @@ pub fn streamDelimiter(r: *Reader, w: *Writer, delimiter: u8) StreamError!usize
858/// Returns number of bytes streamed, which may be zero. End of stream can be861/// Returns number of bytes streamed, which may be zero. End of stream can be
859/// detected by checking if the next byte in the stream is the delimiter.862/// detected by checking if the next byte in the stream is the delimiter.
860///863///
864/// Asserts buffer capacity of at least one. This function performs better with
865/// larger buffers.
866///
861/// See also:867/// See also:
862/// * `streamDelimiter`868/// * `streamDelimiter`
863/// * `streamDelimiterLimit`869/// * `streamDelimiterLimit`
...@@ -884,6 +890,9 @@ pub const StreamDelimiterLimitError = error{...@@ -884,6 +890,9 @@ pub const StreamDelimiterLimitError = error{
884///890///
885/// Returns number of bytes streamed, which may be zero. End of stream can be891/// Returns number of bytes streamed, which may be zero. End of stream can be
886/// detected by checking if the next byte in the stream is the delimiter.892/// detected by checking if the next byte in the stream is the delimiter.
893///
894/// Asserts buffer capacity of at least one. This function performs better with
895/// larger buffers.
887pub fn streamDelimiterLimit(896pub fn streamDelimiterLimit(
888 r: *Reader,897 r: *Reader,
889 w: *Writer,898 w: *Writer,
lib/std/Io/Writer.zig+5
...@@ -560,6 +560,10 @@ pub fn writeAllPreserve(w: *Writer, preserve_length: usize, bytes: []const u8) E...@@ -560,6 +560,10 @@ pub fn writeAllPreserve(w: *Writer, preserve_length: usize, bytes: []const u8) E
560/// A user type may be a `struct`, `vector`, `union` or `enum` type.560/// A user type may be a `struct`, `vector`, `union` or `enum` type.
561///561///
562/// To print literal curly braces, escape them by writing them twice, e.g. `{{` or `}}`.562/// To print literal curly braces, escape them by writing them twice, e.g. `{{` or `}}`.
563///
564/// Asserts `buffer` capacity of at least 2 if a union is printed. This
565/// requirement could be lifted by adjusting the code, but if you trigger that
566/// assertion it is a clue that you should probably be using a buffer.
563pub fn print(w: *Writer, comptime fmt: []const u8, args: anytype) Error!void {567pub fn print(w: *Writer, comptime fmt: []const u8, args: anytype) Error!void {
564 const ArgsType = @TypeOf(args);568 const ArgsType = @TypeOf(args);
565 const args_type_info = @typeInfo(ArgsType);569 const args_type_info = @typeInfo(ArgsType);
...@@ -930,6 +934,7 @@ pub fn printAddress(w: *Writer, value: anytype) Error!void {...@@ -930,6 +934,7 @@ pub fn printAddress(w: *Writer, value: anytype) Error!void {
930 @compileError("cannot format non-pointer type " ++ @typeName(T) ++ " with * specifier");934 @compileError("cannot format non-pointer type " ++ @typeName(T) ++ " with * specifier");
931}935}
932936
937/// Asserts `buffer` capacity of at least 2 if `value` is a union.
933pub fn printValue(938pub fn printValue(
934 w: *Writer,939 w: *Writer,
935 comptime fmt: []const u8,940 comptime fmt: []const u8,