authorgravatar for benjamin.feng@glassdoor.comBenjamin Feng <benjamin.feng@glassdoor.com> 2020-03-06 16:52:46-06:00
committergravatar for benjamin.feng@glassdoor.comBenjamin Feng <benjamin.feng@glassdoor.com> 2020-03-12 10:41:09-05:00
log786216ca5a7cc992d1be895702d37798bc85bf14
tree57353863185ceb895286e664410ebc1e579048cc
parent6a53fe7c93ddc6216e7cd41514bebe701531c9c3

Slap in workaround for Fifo


1 files changed, 13 insertions(+), 1 deletions(-)

lib/std/fifo.zig+13-1
......@@ -294,7 +294,19 @@ pub fn LinearFifo(
294294 pub usingnamespace if (T == u8)
295295 struct {
296296 pub fn print(self: *Self, comptime format: []const u8, args: var) !void {
297 return std.fmt.format(self, error{OutOfMemory}, Self.write, format, args);
297 // TODO: maybe expose this stream as a method?
298 const FifoStream = struct {
299 const OutStream = std.io.OutStream(*Self, Error, write);
300 const Error = error{OutOfMemory};
301
302 fn write(fifo: *Self, bytes: []const u8) Error!usize {
303 try fifo.write(bytes);
304 return bytes.len;
305 }
306 };
307
308 var out_stream = FifoStream.OutStream{ .context = self };
309 try out_stream.print(format, args);
298310 }
299311 }
300312 else