A poolable string builder (aka string buffer) for Zig
0

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #2 from curuvar/cstring

Added cString to Buffer

authored by

Karl Seguin and committed by
GitHub
(Jan 31, 2025, 8:38 AM +0800) a50d5e7c e9c95a77

+9
+9
src/buffer.zig
··· 74 74 return self.buf[0..self.pos]; 75 75 } 76 76 77 + pub fn cString(self: *Buffer) ![:0]const u8 { 78 + // Make sure there is a null byte at the end 79 + 80 + try self.ensureUnusedCapacity(1); 81 + self.buf[self.pos] = 0; 82 + 83 + return self.buf[0..self.pos :0]; 84 + } 85 + 77 86 pub fn truncate(self: *Buffer, n: usize) void { 78 87 const pos = self.pos; 79 88 if (n >= pos) {