A Rust library providing fully persistent data structures with structural sharing.
rpds is a Rust library that implements persistent data structures, which retain previous versions when modified. It provides fully persistent data structures like lists, vectors, maps, and sets that enable efficient functional-style programming by allowing immutable updates with structural sharing, reducing memory overhead.
Rust developers building applications that require immutable data structures for functional programming, concurrency, or versioned data, such as those in compilers, state management systems, or embedded environments.
Developers choose rpds for its combination of correctness, performance, and flexibility, offering both immutable and mutable APIs, thread-safe variants with Arc, no_std support for embedded systems, and optional features like serialization and parallel iterators.
Rust persistent data structures
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
All data structure versions remain accessible after modification, enabling functional programming patterns and easy state versioning for applications like undo/redo systems.
Uses reference-counting pointers (Rc/Arc) to share unchanged parts between versions, reducing memory overhead for immutable updates compared to full copies.
Offers both Rc (single-threaded) and Arc (multi-threaded) variants via the archery crate, allowing developers to tune performance based on concurrency needs.
Provides mutable methods like insert_mut() for when previous versions aren't needed, improving performance over immutable updates in scenarios like batch processing.
Can be used in embedded or no_std environments by disabling the default std feature, making it versatile for systems programming.
Using thread-safe Arc pointers significantly slows cloning and dropping operations—benchmarks show some operations can be twice as slow compared to Rc, impacting multi-threaded performance.
Requires understanding and managing different pointer types (Rc vs Arc) through the archery crate, adding complexity and a learning curve for developers unfamiliar with persistent structures.
Ecosystem support is minimal, with only Python bindings officially listed; this restricts integration in polyglot projects compared to more widely adopted libraries.
Persistent data structures have unique APIs focused on immutability, which can be non-intuitive for developers accustomed to mutable, imperative collections like Vec or HashMap.