diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-12-04 15:28:17 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-12-04 15:28:17 -0500 |
| commit | 42004f9013ba2d06b457f858e0e269ef4ad23554 (patch) | |
| tree | ee99dd89c9ce7e7c30a76e7bf0d9f7da7c0c64c7 /std/buffer.zig | |
| parent | afe3aae582d5051406832e32fc01374f2a0029b7 (diff) | |
| parent | a966275e509670e750ef54a37f7202078aa4cf07 (diff) | |
| download | zig-42004f9013ba2d06b457f858e0e269ef4ad23554.tar.gz zig-42004f9013ba2d06b457f858e0e269ef4ad23554.zip | |
Merge branch 'master' into llvm6
Diffstat (limited to 'std/buffer.zig')
| -rw-r--r-- | std/buffer.zig | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/std/buffer.zig b/std/buffer.zig index a1aa8faf9d..96abaeb762 100644 --- a/std/buffer.zig +++ b/std/buffer.zig @@ -4,6 +4,8 @@ const Allocator = mem.Allocator; const assert = debug.assert; const ArrayList = @import("array_list.zig").ArrayList; +const fmt = @import("fmt/index.zig"); + /// A buffer that allocates memory and maintains a null byte at the end. pub const Buffer = struct { list: ArrayList(u8), @@ -96,6 +98,10 @@ pub const Buffer = struct { mem.copy(u8, self.list.toSlice()[old_len..], m); } + pub fn appendFormat(self: &Buffer, comptime format: []const u8, args: ...) -> %void { + return fmt.format(self, append, format, args); + } + pub fn appendByte(self: &Buffer, byte: u8) -> %void { return self.appendByteNTimes(byte, 1); } |
