Documentation
  • Coverage
  • 91.3%
    21 out of 23 items documented1 out of 21 items with examples
  • Size
  • Source code size: 41.64 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 440.37 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 8s Average build duration of successful builds.
  • all releases: 8s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • cessen/kioku
    4 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • cessen

Kioku

A growable memory arena for Copy types.

This arena works by internally allocating memory in large-ish blocks of memory one-at-a-time, and doling out memory from the current block in linear order until its space runs out.

Additionally, it attempts to minimize wasted space through some heuristics, and has special handling for larger-than-block-size allocation requests.

Some contrived example usage:

let arena = Arena::new().with_block_size(1024);

let integer = arena.alloc(42);
let array1 = arena.copy_slice(&[1, 2, 3, 4, 5, 42]);
assert_eq!(*integer, array1[5]);

*integer = 16;
array1[1] = 16;
assert_eq!(*integer, array1[1]);

let character = arena.alloc('A');
let array2 = arena.alloc_array('A', 42);
assert_eq!(array2.len(), 42);
assert_eq!(*character, array2[20]);

*character = '';
array2[30] = '';
assert_eq!(*character, array2[30]);

Other features include:

  • Allocating with specific memory alignment.
  • Allocating strings.
  • Configurable growth strategies.

License

This project is licensed under either of

at your option.

Contributing

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Kioku by you will be licensed as above, without any additional terms or conditions.