mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
std.fifo.LinearFifo - Expose reader and writer type.
This commit is contained in:
parent
36178caf3e
commit
0aef1faa82
1 changed files with 4 additions and 2 deletions
|
|
@ -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…
Add table
Reference in a new issue