struct StreamInterface [src]

This is an example of the type that is needed by the read and write functions. It can have any fields but it must at least have these functions. Note that std.net.Stream conforms to this interface. This declaration serves as documentation only.

Members

Source

pub const StreamInterface = struct { /// Can be any error set. pub const ReadError = error{}; /// Returns the number of bytes read. The number read may be less than the /// buffer space provided. End-of-stream is indicated by a return value of 0. /// /// The `iovecs` parameter is mutable because so that function may to /// mutate the fields in order to handle partial reads from the underlying /// stream layer. pub fn readv(this: @This(), iovecs: []std.posix.iovec) ReadError!usize { _ = .{ this, iovecs }; @panic("unimplemented"); } /// Can be any error set. pub const WriteError = error{}; /// Returns the number of bytes read, which may be less than the buffer /// space provided. A short read does not indicate end-of-stream. pub fn writev(this: @This(), iovecs: []const std.posix.iovec_const) WriteError!usize { _ = .{ this, iovecs }; @panic("unimplemented"); } /// Returns the number of bytes read, which may be less than the buffer /// space provided, indicating end-of-stream. /// The `iovecs` parameter is mutable in case this function needs to mutate /// the fields in order to handle partial writes from the underlying layer. pub fn writevAll(this: @This(), iovecs: []std.posix.iovec_const) WriteError!usize { // This can be implemented in terms of writev, or specialized if desired. _ = .{ this, iovecs }; @panic("unimplemented"); } }