mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 21:08:36 +00:00
Slap in workaround for Fifo
This commit is contained in:
parent
6a53fe7c93
commit
786216ca5a
@ -294,7 +294,19 @@ pub fn LinearFifo(
|
||||
pub usingnamespace if (T == u8)
|
||||
struct {
|
||||
pub fn print(self: *Self, comptime format: []const u8, args: var) !void {
|
||||
return std.fmt.format(self, error{OutOfMemory}, Self.write, format, args);
|
||||
// TODO: maybe expose this stream as a method?
|
||||
const FifoStream = struct {
|
||||
const OutStream = std.io.OutStream(*Self, Error, write);
|
||||
const Error = error{OutOfMemory};
|
||||
|
||||
fn write(fifo: *Self, bytes: []const u8) Error!usize {
|
||||
try fifo.write(bytes);
|
||||
return bytes.len;
|
||||
}
|
||||
};
|
||||
|
||||
var out_stream = FifoStream.OutStream{ .context = self };
|
||||
try out_stream.print(format, args);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user