| ... | ... | @@ -192,11 +192,25 @@ pub const Stream = struct { |
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | const R = nio.Readable(@This(), ._bare); |
| 196 | pub const readAll = R.readAll; |
| 197 | pub const readAtLeast = R.readAtLeast; |
| 198 | pub const readNoEof = R.readNoEof; |
| 199 | pub const readAllAlloc = R.readAllAlloc; |
| 200 | pub const readArray = R.readArray; |
| 201 | pub const readByte = R.readByte; |
| 202 | pub const readUntilDelimiterArrayList = R.readUntilDelimiterArrayList; |
| 203 | pub const readUntilDelimiterAlloc = R.readUntilDelimiterAlloc; |
| 204 | pub const readUntilDelimitersBuf = R.readUntilDelimitersBuf; |
| 205 | pub const readUntilDelimitersArrayList = R.readUntilDelimitersArrayList; |
| 206 | pub const readAlloc = R.readAlloc; |
| 207 | pub const readInt = R.readInt; |
| 208 | pub const readUntilDelimitersAlloc = R.readUntilDelimitersAlloc; |
| 209 | |
| 195 | 210 | pub const ReadError = switch (builtin.target.os.tag) { |
| 196 | 211 | .linux => sys.errno.Error, |
| 197 | 212 | else => @compileError("TODO"), |
| 198 | 213 | }; |
| 199 | | pub usingnamespace nio.Readable(@This(), ._bare); |
| 200 | 214 | pub fn read(s: Stream, buffer: []u8) ReadError!usize { |
| 201 | 215 | return sys.recv(@intFromEnum(s.socket), buffer, 0); |
| 202 | 216 | } |
| ... | ... | @@ -213,11 +227,20 @@ pub const Stream = struct { |
| 213 | 227 | }; |
| 214 | 228 | } |
| 215 | 229 | |
| 230 | const W = nio.Writable(@This(), ._bare); |
| 231 | pub const writeAll = W.writeAll; |
| 232 | pub const writevAll = W.writevAll; |
| 233 | pub const writeByteNTimes = W.writeByteNTimes; |
| 234 | pub const writeNTimes = W.writeNTimes; |
| 235 | pub const writeInt = W.writeInt; |
| 236 | pub const writeStruct = W.writeStruct; |
| 237 | pub const writeIntPretty = W.writeIntPretty; |
| 238 | pub const print = W.print; |
| 239 | |
| 216 | 240 | pub const WriteError = switch (builtin.target.os.tag) { |
| 217 | 241 | .linux => sys.errno.Error, |
| 218 | 242 | else => @compileError("TODO"), |
| 219 | 243 | }; |
| 220 | | pub usingnamespace nio.Writable(@This(), ._bare); |
| 221 | 244 | pub fn write(s: Stream, bytes: []const u8) WriteError!usize { |
| 222 | 245 | return sys.send(@intFromEnum(s.socket), bytes, 0); |
| 223 | 246 | } |