XU XUv0.16.0

#compress/flate

导入方式: #compress/flate

公开 API: 4 函数, 0 方法, 1 类型, 0 常量, 0 方法集

inflate 与有界 LZ77、固定 Huffman deflate;不可压缩数据使用存储块回退。

struct InflateResult

XuAPI
pub struct InflateResult {
    pub data string
    pub next_pos int
}

用途

承载 data、next_pos 等属性的结构体。

公开字段

data string
数据
next_pos int
字段(int)

inflate

XuAPI
pub fn inflate(src &string) string

用途

解压 DEFLATE 压缩数据流,还原为原始字节串。失败时抛出错误,调用方需处理或继续传播。

参数

src &string
源数据(只读借用,调用方仍持有原值;类型 &string)

返回值

string — 结果字符串

inflate_limit

XuAPI
pub fn inflate_limit(src &string, limit int) string

用途

执行 inflate limit 操作。失败时抛出错误,调用方需处理或继续传播。

参数

src &string
源数据(只读借用,调用方仍持有原值;类型 &string)
limit int
limit(int)

返回值

string — 结果字符串

inflate_from_limit

XuAPI
pub fn inflate_from_limit(src &string, start int, limit int) InflateResult

用途

执行 inflate from limit 操作。失败时抛出错误,调用方需处理或继续传播。

参数

src &string
源数据(只读借用,调用方仍持有原值;类型 &string)
start int
start(int)
limit int
limit(int)

返回值

InflateResult — 该类型的值

deflate

XuAPI
pub fn deflate(src &string) string

用途

将输入数据压缩为标准 DEFLATE 格式字节流。

参数

src &string
源数据(只读借用,调用方仍持有原值;类型 &string)

返回值

string — 结果字符串