io_buffer/
lib.rs

1//! # io-buffer
2//!
3//! This crate provide a [Buffer] type, to unify the difference of different types of buffer,
4//! for disk and network IO:
5//!
6//! * Converts owned buffer, `From<Vec<u8>>` and `To<Vec<u8>>`.
7//!
8//! * Allocation with [malloc()](Buffer::alloc())
9//!
10//! * Allocation with [posix_memalign()](Buffer::aligned())
11//!
12//! * Converts from [const reference](Buffer::from_c_ref_const()),  or from
13//! [mutable reference](Buffer::from_c_ref_mut()) of unsafe c code.
14//!
15//! On debug mode, provides runtime checking if you try to as_mut() a const buffer.
16//!
17//! ## Usage
18//!
19//! Cargo.toml:
20//!
21//! ``` toml
22//! [dependencies]
23//! io-buffer = "1"
24//! ```
25//!
26//! ## Feature flags
27//!
28//! * compress: enable [Compression] trait
29//!
30//! * lz4: enable lz4 compression
31
32extern crate log;
33#[macro_use]
34extern crate captains_log;
35
36mod buffer;
37mod utils;
38
39pub use buffer::{Buffer, MAX_BUFFER_SIZE};
40pub use utils::*;
41
42#[cfg(any(feature = "compress", doc))]
43/// Enabled with feature `compress`
44pub mod compress;
45
46#[cfg(test)]
47mod test;