imbl
The maintained fork of Rust’s im crate: persistent collections with an RRB-tree Vector, a hash array mapped trie HashMap and a B+ tree OrdMap, with O(1) cloning and copy-on-write updates.
- What it is
- Purely functional data structures (rrb vectors)
- Type
- Open source
- Made by
- Joe Neeman and contributors
- License
- MPL-2.0
- Facts checked
- 9 October 2026
What it is
imbl continues the im crate after its author stopped maintaining it. Its 1.0 release was fully compatible with im 15.0.0, so switching is mostly a change of crate name. It offers the same immutable versions of the standard collections: Vector (an RRB tree with O(log n) split and concatenation), HashMap and HashSet (hash array mapped tries) and OrdMap and OrdSet (B+ trees since version 6.0.0). Each tree node holds up to 64 values.
Cloning only bumps a reference count, and a node is copied only when a shared clone changes it; a node nobody else shares is updated in place, about an order of magnitude faster than an immutable update. Collections use thread-safe Arc by default. Instead of a separate im-rc crate, imbl makes the pointer type a parameter through the archery crate, so single-threaded code can use GenericVector<T, RcK> with Rc, and a triomphe feature swaps in a faster Arc. Like im, it is slower than the standard collections at their best operations: Vec wins below several hundred elements and OrdMap runs 2 to 3 times slower than BTreeMap.
The fork has kept releasing: it fixed critical Vector bugs in 2.0.0 (2022), rewrote OrdMap as a B+ tree in 6.0.0 (July 2025), sped up HashMap and the B-tree in 7.0.0 (January 2026), and shipped 7.0.2 in September 2026. It needs Rust 1.85 or later.
Why teams pick it
- A drop-in path off the archived
imcrate, with bug fixes inVector,OrdMapandOrdSet - O(1)
clone, structural sharing and in-place updates of unshared nodes Vectorconcatenates, splits and inserts in the middle in O(log n), whichVecandVecDequecan’t- The shared pointer type is pluggable:
Arcby default,Rcfor single-threaded code, ortriomphe::Arc
Watch out for
- Slower than
Vecfor small collections and thanBTreeMapfor ordered maps, as withim - Values must be
Clone; expensive values need wrapping inRcorArc - Frequent major versions (2.0 in 2022, then 3.0 to 7.0 between 2024 and 2026), and a minimum Rust version that rises over time
Alternatives
What all rrb vectors have in common →How it fits with other technologies
What imbl uses
O(1) clones, RRB concatenation, a B+ tree map and an `Rc` vector (`imbl = "7.0.2"`) · rust
use imbl::{GenericVector, OrdMap, Vector, shared_ptr::RcK};
fn main() {
let v1: Vector<u32> = (0..100_000).collect();
// clone is O(1); the first write copies only the touched chunk and its path
let mut v2 = v1.clone();
v2.set(0, 42);
println!("{} {}", v1[0], v2[0]); // 0 42
// RRB tree: O(log n) concatenation and split
let mut joined = v1.clone();
joined.append(v2);
let tail = joined.split_off(150_000);
println!("{} {}", joined.len(), tail.len()); // 150000 50000
// OrdMap is a B+ tree; update returns a new map and leaves the old one alone
let m1: OrdMap<&str, u32> = OrdMap::unit("tea", 3);
let m2 = m1.update("cake", 5);
println!("{:?} {:?}", m1, m2); // {"tea": 3} {"cake": 5, "tea": 3}
// single-threaded code can swap Arc for the cheaper Rc
let local: GenericVector<u32, RcK> = (1..=3).collect();
println!("{}", local.iter().sum::<u32>()); // 6
}See it in a real stack
No architecture uses imbl yet. Drop it into the playground and wire it up yourself.Open playground →Where it came from2021–2026
Bodil Stokke’s im crate (2017) brought RRB vectors, hash array mapped tries and B-tree maps to Rust, but its last release, 15.1.0, came out in April 2022 and the repository was later archived.
Joe Neeman forked it as imbl in August 2021 and released 1.0.0 on 11 August, “our fork/continuation of im”, fully compatible with im 15.0.0 apart from fixes to deleting from and iterating over large ordered maps and sets. Later releases fixed critical Vector bugs (2.0.0, 2022), made the pointer type generic so one crate covers both Arc and Rc (5.0.0, 2025), rewrote OrdMap and OrdSet as B+ trees (6.0.0, 2025) and improved HashMap memory use and speed (6.1.0 and 7.0.0).
Why it’s built this way
- Fork and stay API-compatible
- Users of the unmaintained
imcrate could switch by changing a dependency, so 1.0 matchedim15.0.0 and listed only the fixes made since. - One crate with a generic pointer type
- Instead of publishing twin crates like
imandim-rc, thearcherycrate lets each collection takeArc,Rcortriomphe::Arcas a type parameter. - B+ trees for ordered maps
- Version 6.0.0 rewrote
OrdMapandOrdSetas B+ trees for significant performance gains, keeping O(log n) operations.
Timeline
- 2021
Joe Neeman releases
imbl1.0.0, compatible withim15.0.0 (August) - 2022
2.0.0 fixes several critical
Vectorbugs (April) - 2025
5.0.0 adds pluggable pointer types; 6.0.0 rewrites
OrdMapas a B+ tree - 2026
7.0.0 (January) speeds up
HashMapand the B-tree; 7.0.2 in September