struct Stream
pub struct Stream {
pub c net.Conn
}Purpose
Structure encapsulating c.
Public fields
cnet.Conn- byte or character code
#net/streamStream wraps net.Conn with the same method names tls.Conn uses (read / write / set_*_deadline / close) so a service loop can be written once. Xu has no interfaces — tls.Conn already has this method set; branch on a bool at the dial site if you mix both. net/stream does not import crypto/tls (tls already imports net). read may throw (deadline/IO); write/close follow net.Conn.
struct Streampub struct Stream {
pub c net.Conn
}Structure encapsulating c.
c net.Connfrom_tcppub fn from_tcp(c net.Conn) Streamfrom_tcp wraps a net.Conn.
c net.ConnStream — a value of this type
(&Stream) fdpub fn (s &Stream) fd() intExecute fd on &Stream. Throws on failure; handle the error or propagate it to the caller.
s &StreamStream instance used by this call (borrow).int — a value of this type
(Stream) remote_addrpub fn (s Stream) remote_addr() stringOperation on Stream: remote address.
s StreamStream instance used by this call (value receiver).string — result string
($&Stream) readpub fn (s $&Stream) read(max int) stringread may throw on IO/deadline error. Throws on failure; handle the error or propagate it to the caller.
s $&StreamStream instance used by this call (exclusive borrow).max intstring — result string
($&Stream) writepub fn (s $&Stream) write(data &string) intOperation on $&Stream: write data and return the byte count. Throws on failure; handle the error or propagate it to the caller.
s $&StreamStream instance used by this call (exclusive borrow).data &stringint — bytes written
($&Stream) set_read_deadlinepub fn (s $&Stream) set_read_deadline(t_ns int) intOperation on $&Stream: set read deadline.
s $&StreamStream instance used by this call (exclusive borrow).t_ns intint — a value of this type
($&Stream) set_write_deadlinepub fn (s $&Stream) set_write_deadline(t_ns int) intOperation on $&Stream: set write deadline.
s $&StreamStream instance used by this call (exclusive borrow).t_ns intint — a value of this type
($&Stream) set_deadlinepub fn (s $&Stream) set_deadline(t_ns int) intOperation on $&Stream: set deadline.
s $&StreamStream instance used by this call (exclusive borrow).t_ns intint — a value of this type
($&Stream) closepub fn (s $&Stream) close() intOperation on $&Stream: close the resource. Throws on failure; handle the error or propagate it to the caller.
s $&StreamStream instance used by this call (exclusive borrow).int — a value of this type
($&Stream) read_resultpub fn (s $&Stream) read_result(n int) io.ReadResultOperation on $&Stream: read result.
s $&StreamStream instance used by this call (exclusive borrow).n intio.ReadResult — a value of this type
($&Stream) write_resultpub fn (s $&Stream) write_result(data string) io.WriteResultOperation on $&Stream: write result.
s $&StreamStream instance used by this call (exclusive borrow).data stringio.WriteResult — a value of this type