authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-22 03:26:10 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-22 03:26:10 -07:00
loge38e2db61b76404503f78defc53af5d1a72a6a02
tree28a4e67b96d17d861ffb4f846694485bff70aae8
parentfc341bcc52aebe7acc079179e0b46e231dc43053
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

eliminate usingnamespace


1 files changed, 25 insertions(+), 2 deletions(-)

File.zig+25-2
...@@ -23,11 +23,25 @@ pub fn close(self: File) void {...@@ -23,11 +23,25 @@ pub fn close(self: File) void {
23 sys_linux.close(@intFromEnum(self.fd)) catch {};23 sys_linux.close(@intFromEnum(self.fd)) catch {};
24}24}
2525
26const R = nio.Readable(@This(), ._bare);
27pub const readAll = R.readAll;
28pub const readAtLeast = R.readAtLeast;
29pub const readNoEof = R.readNoEof;
30pub const readAllAlloc = R.readAllAlloc;
31pub const readArray = R.readArray;
32pub const readByte = R.readByte;
33pub const readUntilDelimiterArrayList = R.readUntilDelimiterArrayList;
34pub const readUntilDelimiterAlloc = R.readUntilDelimiterAlloc;
35pub const readUntilDelimitersBuf = R.readUntilDelimitersBuf;
36pub const readUntilDelimitersArrayList = R.readUntilDelimitersArrayList;
37pub const readAlloc = R.readAlloc;
38pub const readInt = R.readInt;
39pub const readUntilDelimitersAlloc = R.readUntilDelimitersAlloc;
40
26pub const ReadError = switch (builtin.target.os.tag) {41pub const ReadError = switch (builtin.target.os.tag) {
27 .linux => sys_linux.errno.Error,42 .linux => sys_linux.errno.Error,
28 else => @compileError("TODO"),43 else => @compileError("TODO"),
29};44};
30pub usingnamespace nio.Readable(@This(), ._bare);
31pub fn read(self: File, buffer: []u8) ReadError!usize {45pub fn read(self: File, buffer: []u8) ReadError!usize {
32 if (os == .linux)46 if (os == .linux)
33 return sys_linux.read(@intFromEnum(self.fd), buffer);47 return sys_linux.read(@intFromEnum(self.fd), buffer);
...@@ -89,8 +103,17 @@ pub fn readAllArrayList(self: File, array_list: *std.ArrayList(u8), max_append_s...@@ -89,8 +103,17 @@ pub fn readAllArrayList(self: File, array_list: *std.ArrayList(u8), max_append_s
89 }103 }
90}104}
91105
106const W = nio.Writable(@This(), ._bare);
107pub const writeAll = W.writeAll;
108pub const writevAll = W.writevAll;
109pub const writeByteNTimes = W.writeByteNTimes;
110pub const writeNTimes = W.writeNTimes;
111pub const writeInt = W.writeInt;
112pub const writeStruct = W.writeStruct;
113pub const writeIntPretty = W.writeIntPretty;
114pub const print = W.print;
115
92pub const WriteError = sys.errno.Error;116pub const WriteError = sys.errno.Error;
93pub usingnamespace nio.Writable(@This(), ._bare);
94pub fn write(self: File, buffer: []const u8) WriteError!usize {117pub fn write(self: File, buffer: []const u8) WriteError!usize {
95 return sys.write(@intFromEnum(self.fd), buffer);118 return sys.write(@intFromEnum(self.fd), buffer);
96}119}