std.Io.net.Stream: add "const" variant to "close"

useful for resource management
This commit is contained in:
Andrew Kelley 2025-10-15 11:00:33 -07:00
parent 80069c1e69
commit 426a377c7b

View File

@ -1154,6 +1154,11 @@ pub const Stream = struct {
s.* = undefined;
}
/// Same as `close` but doesn't try to set `Stream` to `undefined`.
pub fn closeConst(s: *const Stream, io: Io) void {
io.vtable.netClose(io.userdata, s.socket.handle);
}
pub const Reader = struct {
io: Io,
interface: Io.Reader,