struct Stream
XuAPI
pub struct Stream {
pub c net.Conn
}用途
公开结构体 `Stream`。
参数
cnet.Conn- 字节或字符码
API
#net/stream标准库包 `#net/stream`。
struct Streampub struct Stream {
pub c net.Conn
}公开结构体 `Stream`。
c net.Connfrom_tcppub fn from_tcp(c net.Conn) Stream从 tcp 构造。
c net.ConnStream — 该类型的值
(&Stream) fdpub fn (s &Stream) fd() int在 `&Stream` 上调用 `fd`。失败时 throw。
s &Streamint — 该类型的值
(Stream) remote_addrpub fn (s Stream) remote_addr() string`Stream` 上的方法:remote地址。
s Streamstring — 结果字符串
(&mut Stream) readpub fn (s &mut Stream) read(max int) string`&mut Stream` 上的方法:读出最多 max 字节。失败时 throw。
s &mut Streammax intstring — 结果字符串
(&mut Stream) writepub fn (s &mut Stream) write(data &string) int`&mut Stream` 上的方法:写入数据,返回写入的字节数。失败时 throw。
s &mut Streamdata &stringint — 写入的字节数
(&mut Stream) set_read_deadlinepub fn (s &mut Stream) set_read_deadline(t_ns int) int`&mut Stream` 上的方法:设置 read deadline。
s &mut Streamt_ns intint — 该类型的值
(&mut Stream) set_write_deadlinepub fn (s &mut Stream) set_write_deadline(t_ns int) int`&mut Stream` 上的方法:设置 write deadline。
s &mut Streamt_ns intint — 该类型的值
(&mut Stream) set_deadlinepub fn (s &mut Stream) set_deadline(t_ns int) int`&mut Stream` 上的方法:设置 deadline。
s &mut Streamt_ns intint — 该类型的值
(&mut Stream) closepub fn (s &mut Stream) close() int`&mut Stream` 上的方法:关闭资源。失败时 throw。
s &mut Streamint — 该类型的值
(&mut Stream) read_resultpub fn (s &mut Stream) read_result(n int) io.ReadResult`&mut Stream` 上的方法:读取结果。
s &mut Streamn intio.ReadResult — 该类型的值
(&mut Stream) write_resultpub fn (s &mut Stream) write_result(data string) io.WriteResult`&mut Stream` 上的方法:写入结果。
s &mut Streamdata stringio.WriteResult — 该类型的值