Crates.io | rodeo |
lib.rs | rodeo |
version | 0.2.1 |
source | src |
created_at | 2022-11-16 08:51:07.613357 |
updated_at | 2024-03-25 15:24:42.323447 |
description | Fast dropping arena based on bumpalo |
homepage | |
repository | https://github.com/polazarus/rodeo |
max_upload_size | |
id | 716236 |
size | 42,877 |
A dropping untyped arena based on bumpalo:
typed_arena
bumpalo
Rodeo only supports owned types for now.
Thanks to @TimNN and MIRI for pointing out my shortsightness.
use rodeo::Rodeo;
struct S;
impl Drop for S {
fn drop(&mut self) {
println!("dropping S");
}
}
{
let rodeo = Rodeo::new();
let n = rodeo.alloc(42);
let r = rodeo.alloc(S);
}
prints dropping S
#[no_std]
Supportbumpalo
(default)
If not selected, you will have to plug your own allocator that implements the trait ArenaAlloc
.
std
(default)
For now, rodeo
is mostly a no_std
crate. But std
makes debugging a whole lot simpler!
You have to opt-out of bumpalo
and std
with default-features = false
.
As a memory management library, this code uses unsafe
extensively. However, the code is tested and dynamically verified with Miri.
Run the tests simply with:
cargo test
Miri is an interpreter for MIR (an intermediate representation of Rust) that checks Rust code and in particular unsafe code against the experimental Stacked Borrows memory model.
As of miri 0.1.0 (c1a859b 2022-11-10)
, Rodeo's tests show no error or warning when run with Miri.
rustup +nightly component add miri # if needed
cargo +nightly miri test
LEAK=1 cargo +nightly miri test # should leak two buffers
add generic DST allocation, hide behind feature pending stabilization of Rust RFC 2580
investigate rodeo
's use for self-referential structures
Rodeo is distributed under the terms of both the MIT license and the Apache License (Version 2.0). See LICENSE-MIT and LICENSE-APACHE.