XU XUv0.8.8
EN

API

#compress/zlib

import: #compress/zlib

counts: 2 函数, 6 方法, 2 类型, 0 常量, 0 方法集

zlib Reader/Writer,校验 Adler-32;拒字典。

struct Reader

XuAPI
pub struct Reader {
    pub data string
    pub sticky string
}

用途

公开结构体 `Reader`。

参数

data string
数据
sticky string
字段(string)

struct Writer

XuAPI
pub struct Writer {
    pub buf string
    pub out string
    pub closed bool
}

用途

公开结构体 `Writer`。

参数

buf string
缓冲
out string
字段(string)
closed bool
字段(bool)

new_reader

XuAPI
pub fn new_reader(data string) Reader

用途

构造 reader。

参数

data string
数据(string)

返回

Reader — 该类型的值

new_writer

XuAPI
pub fn new_writer() Writer

用途

构造 writer。

参数

无

返回

Writer — 该类型的值

(&mut Reader) read_all

XuAPI
pub fn (r &mut Reader) read_all() string

用途

`&mut Reader` 上的方法:读取all。失败时 throw。

参数

r &mut Reader
接收者 &mut Reader(可变借用)

返回

string — 结果字符串

(&mut Writer) write

XuAPI
pub fn (w &mut Writer) write(data &string) int

用途

`&mut Writer` 上的方法:写入数据,返回写入的字节数。失败时 throw。

参数

w &mut Writer
接收者 &mut Writer(可变借用)
data &string
数据(借用,调用方仍持有;类型 &string)

返回

int — 写入的字节数

(&mut Writer) write_string

XuAPI
pub fn (w &mut Writer) write_string(s string) int

用途

`&mut Writer` 上的方法:写入字符串,返回写入的字节数。

参数

w &mut Writer
接收者 &mut Writer(可变借用)
s string
源字符串(string)

返回

int — 写入的字节数

(&mut Writer) close

XuAPI
pub fn (w &mut Writer) close() int

用途

`&mut Writer` 上的方法:关闭资源。

参数

w &mut Writer
接收者 &mut Writer(可变借用)

返回

int — 该类型的值

(&Writer) bytes

XuAPI
pub fn (w &Writer) bytes() string

用途

`&Writer` 上的方法:返回已缓冲的字节串。

参数

w &Writer
接收者 &Writer(借用)

返回

string — 结果字符串

(&Writer) text

XuAPI
pub fn (w &Writer) text() string

用途

`&Writer` 上的方法:返回当前文本。

参数

w &Writer
接收者 &Writer(借用)

返回

string — 结果字符串