1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//! # arena-lib
//!
//! TYPED MEMORY ARENAS AND SLAB ALLOCATION
//!
//! `arena-lib` collects four allocator primitives behind a single, safe Rust
//! surface: a generational [`Arena`], a string [`Interner`], a [`Bump`]
//! arena, and the supporting [`Index`] / [`Symbol`] / [`Error`] types. Every
//! public path is safe Rust; `unsafe` is internal-only, measured, and
//! documented at the call site.
//!
//! # Quick tour
//!
//! ```
//! use arena_lib::{Arena, Bump, Interner};
//!
//! // Generational arena — stable handles, use-after-free detection.
//! let mut arena = Arena::new();
//! let alice = arena.insert("alice");
//! let bob = arena.insert("bob");
//! assert_eq!(arena.get(alice), Some(&"alice"));
//! let _ = arena.remove(alice);
//! assert_eq!(arena.get(alice), None); // stale handle, safely rejected
//!
//! // Interner — O(1) equality on repeated identifiers.
//! let mut interner = Interner::new();
//! let id_a = interner.intern("user:42");
//! let id_b = interner.intern("user:42");
//! assert_eq!(id_a, id_b);
//!
//! // Bump arena — fast scratch, reset in O(1).
//! let mut bump = Bump::with_capacity(64);
//! let n = bump.alloc(7_u32);
//! assert_eq!(*n, 7);
//! bump.reset();
//!
//! let _ = bob;
//! ```
//!
//! # Modules
//!
//! - [`arena`] — generational arena and [`Index`] handle.
//! - [`intern`] — string interner and [`Symbol`] handle.
//! - [`bump`] — multi-chunk bump arena for short-lived scratch (no drop).
//! - [`drop_arena`] — typed bump-style arena that runs destructors.
//! - [`error`] — single public [`Error`] type and [`Result`] alias.
//! - [`prelude`] — convenience re-exports for downstream crates.
//!
//! # `no_std`
//!
//! Disable default features (`std`) to compile under `#![no_std]`. The crate
//! still requires `alloc` — it is pulled in automatically.
//!
//! # License
//!
//! Dual-licensed under Apache-2.0 OR MIT.
extern crate alloc;
pub use crate;
pub use crateBump;
pub use crateDropArena;
pub use crate;
pub use crate;
/// Crate version string, populated by Cargo at build time.
///
/// Matches the `version` field in `Cargo.toml` exactly. Useful for diagnostics,
/// telemetry, and `--version` output in tools that embed `arena-lib`.
///
/// # Examples
///
/// ```
/// use arena_lib::VERSION;
///
/// assert!(!VERSION.is_empty());
/// assert!(VERSION.chars().next().is_some_and(|c| c.is_ascii_digit()));
/// ```
pub const VERSION: &str = env!;