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 {
2323 sys_linux.close(@intFromEnum(self.fd)) catch {};
2424}
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
2641pub const ReadError = switch (builtin.target.os.tag) {
2742 .linux => sys_linux.errno.Error,
2843 else => @compileError("TODO"),
2944};
30pub usingnamespace nio.Readable(@This(), ._bare);
3145pub fn read(self: File, buffer: []u8) ReadError!usize {
3246 if (os == .linux)
3347 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
89103 }
90104}
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
92116pub const WriteError = sys.errno.Error;
93pub usingnamespace nio.Writable(@This(), ._bare);
94117pub fn write(self: File, buffer: []const u8) WriteError!usize {
95118 return sys.write(@intFromEnum(self.fd), buffer);
96119}