io-buffer

Crates.ioio-buffer
lib.rsio-buffer
version1.0.3
created_at2025-06-23 17:22:58.060698+00
updated_at2025-07-31 19:45:56.705163+00
descriptionA buffer abstracted for disk and network IO, with static lifetime. Unify Vec and *libc::c_void into one type, with smallest mem footprint.
homepage
repositoryhttps://github.com/NaturalIO/io-buffer-rs
max_upload_size
id1723207
size43,944
Adam Ning (frostyplanet)

documentation

https://docs.rs/io-buffer

README

io-buffer

Build Status Cargo Documentation Rust 1.36+

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>> and To<Vec<u8>>.

  • Allocation with malloc()(Buffer::alloc())

  • Allocation with posix_memalign()(Buffer::aligned())

  • Converts from const reference (Buffer::from_c_ref_const()), or from mutable reference (Buffer::from_c_ref_mut()) 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

Commit count: 0

cargo fmt