Expand description
§io-buffer
This crate provide a Buffer type, to unify the difference of different types of buffer, for disk and network IO:
-
Converts owned buffer,
From<Vec<u8>>
andTo<Vec<u8>>
. -
Allocation with malloc()
-
Allocation with posix_memalign()
-
Converts from const reference, or from mutable reference of unsafe c code.
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
Modules§
- compress
- Enabled with feature
compress
Structs§
- Buffer
- Buffer is a static type, size and cap (max to u32). Memory footprint is only 16B.
Constants§
Functions§
- is_
all_ zero - Test whether a buffer is all set to zero
- rand_
buffer - Produce ascii random string
- safe_
copy - safe_copy regardless the size of buffer.
- set_
zero - Set a buffer to zero