| ... | @@ -24,9 +24,9 @@ pub const FormatOptions = struct { | ... | @@ -24,9 +24,9 @@ pub const FormatOptions = struct { |
| 24 | fill: u8 = ' ', | 24 | fill: u8 = ' ', |
| 25 | }; | 25 | }; |
| 26 | | 26 | |
| 27 | /// Renders fmt string with args, calling output with slices of bytes. | 27 | /// Renders fmt string with args, calling `writer` with slices of bytes. |
| 28 | /// If `output` returns an error, the error is returned from `format` and | 28 | /// If `writer` returns an error, the error is returned from `format` and |
| 29 | /// `output` is not called again. | 29 | /// `writer` is not called again. |
| 30 | /// | 30 | /// |
| 31 | /// The format string must be comptime known and may contain placeholders following | 31 | /// The format string must be comptime known and may contain placeholders following |
| 32 | /// this format: | 32 | /// this format: |
| ... | @@ -1869,6 +1869,9 @@ pub const BufPrintError = error{ | ... | @@ -1869,6 +1869,9 @@ pub const BufPrintError = error{ |
| 1869 | /// As much as possible was written to the buffer, but it was too small to fit all the printed bytes. | 1869 | /// As much as possible was written to the buffer, but it was too small to fit all the printed bytes. |
| 1870 | NoSpaceLeft, | 1870 | NoSpaceLeft, |
| 1871 | }; | 1871 | }; |
| | 1872 | |
| | 1873 | /// print a Formatter string into `buf`. Actually just a thin wrapper around `format` and `fixedBufferStream`. |
| | 1874 | /// returns a slice of the bytes printed to. |
| 1872 | pub fn bufPrint(buf: []u8, comptime fmt: []const u8, args: anytype) BufPrintError![]u8 { | 1875 | pub fn bufPrint(buf: []u8, comptime fmt: []const u8, args: anytype) BufPrintError![]u8 { |
| 1873 | var fbs = std.io.fixedBufferStream(buf); | 1876 | var fbs = std.io.fixedBufferStream(buf); |
| 1874 | try format(fbs.writer(), fmt, args); | 1877 | try format(fbs.writer(), fmt, args); |