byte-pool

Crates.iobyte-pool
lib.rsbyte-pool
version0.2.4
sourcesrc
created_at2019-11-13 12:13:37.458825
updated_at2023-04-12 10:55:04.220872
descriptionPool of byte slices, for efficient memory usage
homepage
repositoryhttps://github.com/dignifiedquire/byte-pool
max_upload_size
id180953
size32,654
link2xt (link2xt)

documentation

README

byte-pool

A flexible byte pool.

Crates.io version Download docs.rs docs CI status

API Docs | Releases


Example

use byte_pool::BytePool;

// Create a pool
let pool = BytePool::<Vec<u8>>::new();

// Allocate a buffer
let mut buf = pool.alloc(1024);

// write some data into it
for i in 0..100 {
  buf[i] = 12;
}

// Check that we actually wrote sth.
assert_eq!(buf[55], 12);

// Returns the underlying memory to the pool.
drop(buf);

// Frees all memory in the pool.
drop(pool);

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Commit count: 31

cargo fmt