mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
docs: add more documentation to each of the modules in vlib (#13043)
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
## Description:
|
||||
|
||||
`compress.zlib` implements zlib compression and decompression of binary data.
|
||||
`compress.zlib` is a module that assists in the compression and
|
||||
decompression of binary data using `zlib` compression
|
||||
|
||||
## Examples:
|
||||
|
||||
|
@ -8,6 +8,8 @@ pub const max_size = u64(1 << 31)
|
||||
fn C.tdefl_compress_mem_to_heap(source_buf voidptr, source_buf_len usize, out_len &usize, flags int) voidptr
|
||||
fn C.tinfl_decompress_mem_to_heap(source_buf voidptr, source_buf_len usize, out_len &usize, flags int) voidptr
|
||||
|
||||
// compresses an array of bytes using zlib and returns the compressed bytes in a new array
|
||||
// Example: compressed := zlib.compress(b) ?
|
||||
[manualfree]
|
||||
pub fn compress(data []byte) ?[]byte {
|
||||
if u64(data.len) > zlib.max_size {
|
||||
@ -33,6 +35,8 @@ pub fn compress(data []byte) ?[]byte {
|
||||
return copy
|
||||
}
|
||||
|
||||
// decompresses an array of bytes using zlib and returns the decompressed bytes in a new array
|
||||
// Example: decompressed := zlib.decompress(b) ?
|
||||
[manualfree]
|
||||
pub fn decompress(data []byte) ?[]byte {
|
||||
mut out_len := usize(0)
|
||||
|
Reference in New Issue
Block a user