Skip to content

Commit e255415

Browse files
committed
std: add some missing doc comments
1 parent 88e50b3 commit e255415

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

lib/std/Io/Reader.zig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,9 @@ pub fn peekDelimiterExclusive(r: *Reader, delimiter: u8) DelimiterError![]u8 {
840840
/// Returns number of bytes streamed, which may be zero, or error.EndOfStream
841841
/// if the delimiter was not found.
842842
///
843+
/// Asserts buffer capacity of at least one. This function performs better with
844+
/// larger buffers.
845+
///
843846
/// See also:
844847
/// * `streamDelimiterEnding`
845848
/// * `streamDelimiterLimit`
@@ -858,6 +861,9 @@ pub fn streamDelimiter(r: *Reader, w: *Writer, delimiter: u8) StreamError!usize
858861
/// Returns number of bytes streamed, which may be zero. End of stream can be
859862
/// detected by checking if the next byte in the stream is the delimiter.
860863
///
864+
/// Asserts buffer capacity of at least one. This function performs better with
865+
/// larger buffers.
866+
///
861867
/// See also:
862868
/// * `streamDelimiter`
863869
/// * `streamDelimiterLimit`
@@ -884,6 +890,9 @@ pub const StreamDelimiterLimitError = error{
884890
///
885891
/// Returns number of bytes streamed, which may be zero. End of stream can be
886892
/// 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.
887896
pub fn streamDelimiterLimit(
888897
r: *Reader,
889898
w: *Writer,

lib/std/Io/Writer.zig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,10 @@ pub fn writeAllPreserve(w: *Writer, preserve_length: usize, bytes: []const u8) E
560560
/// A user type may be a `struct`, `vector`, `union` or `enum` type.
561561
///
562562
/// 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.
563567
pub fn print(w: *Writer, comptime fmt: []const u8, args: anytype) Error!void {
564568
const ArgsType = @TypeOf(args);
565569
const args_type_info = @typeInfo(ArgsType);
@@ -930,6 +934,7 @@ pub fn printAddress(w: *Writer, value: anytype) Error!void {
930934
@compileError("cannot format non-pointer type " ++ @typeName(T) ++ " with * specifier");
931935
}
932936

937+
/// Asserts `buffer` capacity of at least 2 if `value` is a union.
933938
pub fn printValue(
934939
w: *Writer,
935940
comptime fmt: []const u8,

0 commit comments

Comments
 (0)