#byte #pool #memory

byte-pool

Pool of byte slices, for efficient memory usage

5 releases

0.2.3 Mar 28, 2021
0.2.2 Jul 29, 2020
0.2.1 Dec 14, 2019
0.2.0 Nov 20, 2019
0.1.0 Nov 13, 2019
Download history 6327/week @ 2020-12-29 8992/week @ 2021-01-05 9351/week @ 2021-01-12 8417/week @ 2021-01-19 8771/week @ 2021-01-26 8505/week @ 2021-02-02 9365/week @ 2021-02-09 10324/week @ 2021-02-16 10959/week @ 2021-02-23 8755/week @ 2021-03-02 11756/week @ 2021-03-09 10462/week @ 2021-03-16 9325/week @ 2021-03-23 7290/week @ 2021-03-30 9240/week @ 2021-04-06 7372/week @ 2021-04-13

39,929 downloads per month
Used in 51 crates (3 directly)

Apache-2.0/MIT

13KB
285 lines

byte-pool

A flexible byte pool.


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.

Dependencies

~165KB