XU XUv0.16.0

#compress/zlib

import: #compress/zlib

counts: 4 functions, 6 methods, 2 types, 0 constants, 0 method sets

zlib Reader/Writer with Adler-32; dictionaries rejected.

struct Reader

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

Purpose

Zlib Streaming reader and decoder.

Public fields

data string
data
sticky string
field (string)

struct Writer

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

Purpose

Zlib Streaming writer and encoder.

Public fields

buf string
buffer
out string
field (string)
closed bool
field (bool)

new_reader

XuAPI
pub fn new_reader(data string) Reader

Purpose

Construct reader.

Parameters

data string
data (string)

Returns

Reader — a value of this type

new_writer

XuAPI
pub fn new_writer() Writer

Purpose

Construct writer.

Parameters

No arguments are required.

Returns

Writer — a value of this type

($&Reader) read_all

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

Purpose

Operation on $&Reader: read all. Throws on failure; handle the error or propagate it to the caller.

Parameters

r $&Reader
The Reader instance used by this call (exclusive borrow).

Returns

string — result string

($&Writer) write

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

Purpose

Operation on $&Writer: write data and return the byte count. Throws on failure; handle the error or propagate it to the caller.

Parameters

w $&Writer
The Writer instance used by this call (exclusive borrow).
data &string
data (read-only borrow; caller keeps the original; type &string)

Returns

int — bytes written

($&Writer) write_string

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

Purpose

Operation on $&Writer: write a string and return the byte count.

Parameters

w $&Writer
The Writer instance used by this call (exclusive borrow).
s string
source string (string)

Returns

int — bytes written

($&Writer) close

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

Purpose

Operation on $&Writer: close the resource.

Parameters

w $&Writer
The Writer instance used by this call (exclusive borrow).

Returns

int — a value of this type

(&Writer) bytes

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

Purpose

Operation on &Writer: return the buffered bytes.

Parameters

w &Writer
The Writer instance used by this call (borrow).

Returns

string — result string

(&Writer) text

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

Purpose

Operation on &Writer: return the current text.

Parameters

w &Writer
The Writer instance used by this call (borrow).

Returns

string — result string

compress_bytes

XuAPI
pub fn compress_bytes(src &[]u8) []u8

Purpose

Compress bytes.

Parameters

src &[]u8
source (read-only borrow; caller keeps the original; type &[]u8)

Returns

[]u8 — slice result

decompress_bytes

XuAPI
pub fn decompress_bytes(src &[]u8) []u8

Purpose

Decompress bytes. Throws on failure; handle the error or propagate it to the caller.

Parameters

src &[]u8
source (read-only borrow; caller keeps the original; type &[]u8)

Returns

[]u8 — slice result