mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 07:32:44 +00:00
std.fifo.LinearFifo - Expose reader and writer type.
This commit is contained in:
parent
36178caf3e
commit
0aef1faa82
@ -44,6 +44,8 @@ pub fn LinearFifo(
|
||||
count: usize,
|
||||
|
||||
const Self = @This();
|
||||
pub const Reader = std.io.Reader(*Self, error{}, readFn);
|
||||
pub const Writer = std.io.Writer(*Self, error{OutOfMemory}, appendWrite);
|
||||
|
||||
// Type of Self argument for slice operations.
|
||||
// If buffer is inline (Static) then we need to ensure we haven't
|
||||
@ -228,7 +230,7 @@ pub fn LinearFifo(
|
||||
return self.read(dest);
|
||||
}
|
||||
|
||||
pub fn reader(self: *Self) std.io.Reader(*Self, error{}, readFn) {
|
||||
pub fn reader(self: *Self) Reader {
|
||||
return .{ .context = self };
|
||||
}
|
||||
|
||||
@ -318,7 +320,7 @@ pub fn LinearFifo(
|
||||
return bytes.len;
|
||||
}
|
||||
|
||||
pub fn writer(self: *Self) std.io.Writer(*Self, error{OutOfMemory}, appendWrite) {
|
||||
pub fn writer(self: *Self) Writer {
|
||||
return .{ .context = self };
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user