Skip to main content

Crate io_buffer

Crate io_buffer 

Source
Expand description

§io-buffer

Build Status Cargo Documentation Rust 1.36+

This crate provide a 16 Bytes Buffer type, to unify the difference of different types of buffer, for disk and network IO:

On debug mode, provides runtime checking if you try to as_mut() a const buffer.

§Usage

Cargo.toml:

[dependencies]
io-buffer = "1"

§Feature flags

  • compress: enable [Compression] trait

  • lz4: enable lz4 compression

  • rand: enable rand_buffer() function

  • fail: enable fail injection point “alloc_buf” of return buffer allocate with random uninit content

Modules§

compresscompress
Enabled with feature compress

Structs§

Buffer
Buffer is a static type, size and cap (max to i32). Memory footprint is only 16B.

Constants§

MAX_BUFFER_SIZE

Functions§

is_all_zero
Test whether a buffer is all set to zero
rand_bufferrand
Produce ascii random string
safe_copy
Only copy the 0..min(dst, src) of src to dst, return the bytes copied.
set_zero
Set a buffer to zero