mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +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,
|
count: usize,
|
||||||
|
|
||||||
const Self = @This();
|
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.
|
// Type of Self argument for slice operations.
|
||||||
// If buffer is inline (Static) then we need to ensure we haven't
|
// If buffer is inline (Static) then we need to ensure we haven't
|
||||||
@ -228,7 +230,7 @@ pub fn LinearFifo(
|
|||||||
return self.read(dest);
|
return self.read(dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn reader(self: *Self) std.io.Reader(*Self, error{}, readFn) {
|
pub fn reader(self: *Self) Reader {
|
||||||
return .{ .context = self };
|
return .{ .context = self };
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,7 +320,7 @@ pub fn LinearFifo(
|
|||||||
return bytes.len;
|
return bytes.len;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn writer(self: *Self) std.io.Writer(*Self, error{OutOfMemory}, appendWrite) {
|
pub fn writer(self: *Self) Writer {
|
||||||
return .{ .context = self };
|
return .{ .context = self };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user