| ... | ... | @@ -4,6 +4,8 @@ const Allocator = mem.Allocator; |
| 4 | 4 | const assert = debug.assert; |
| 5 | 5 | const ArrayList = @import("array_list.zig").ArrayList; |
| 6 | 6 | |
| 7 | const fmt = @import("fmt/index.zig"); |
| 8 | |
| 7 | 9 | /// A buffer that allocates memory and maintains a null byte at the end. |
| 8 | 10 | pub const Buffer = struct { |
| 9 | 11 | list: ArrayList(u8), |
| ... | ... | @@ -96,6 +98,10 @@ pub const Buffer = struct { |
| 96 | 98 | mem.copy(u8, self.list.toSlice()[old_len..], m); |
| 97 | 99 | } |
| 98 | 100 | |
| 101 | pub fn appendFormat(self: &Buffer, comptime format: []const u8, args: ...) -> %void { |
| 102 | return fmt.format(self, append, format, args); |
| 103 | } |
| 104 | |
| 99 | 105 | pub fn appendByte(self: &Buffer, byte: u8) -> %void { |
| 100 | 106 | return self.appendByteNTimes(byte, 1); |
| 101 | 107 | } |