crates-url codecov pipeline status

Kitty Pool

Purpose

The goal of this crate is to provide a safe and easy to use buffer pool in both a single-threaded and multi-threaded environment. The 'Kitty Pool' allows for requesting of 'Ranges', which act as owned slices into the buffer. The user of the 'Ranges' can then safely read and write to the owned parts of the buffer. The 'Kitty Pool' also allows for a standard scatter gather list implementation.

Example

```rust use kitty_pool::*;

const POOLSIZE: usize = 1024; const BLOCKSIZE: usize = 64; const REQUEST_SIZE: usize = 256;

fn main() { // Supports Contiguous and ScatterGatherList let result = kittypool(KittyPoolOrganization::Contiguous, POOLSIZE, BLOCKSIZE); assert!(result.isok()); let mut kittypool = result.unwrap(); let randstring: String = threadrng() .sampleiter(&Alphanumeric) .take(REQUESTSIZE) .collect(); let randbytes: Vec = Vec::from(randstring.asbytes()); let mut buffer = vec![0; REQUESTSIZE]; let future = async { let mut token = kittypool.borrow(REQUESTSIZE).await; assert!(token.isok()); token = kittypool.write(&token.unwrap(), &randbytes).await; assert!(token.isok()); token = kittypool.read(&token.unwrap(), &mut buffer).await; assert!(token.isok()); asserteq!(*buffer, *randbytes); assert!(kittypool.release(&token.unwrap()).isok()); }; blockon(future); } ```