Description:
- Python bindings to the Rust rpds crate for persistent data structures.
Resources:
- [GitHub] https://github.com/crate-py/rpds
- [Rust Crate Docs] https://docs.rs/rpds/latest/rpds/
Example 1
Section titled “Example 1”Create a hash trie map
from rpds import HashTrieMap
m = HashTrieMap({"foo": "bar", "baz": "quux"})m.insert("spam", 37) == HashTrieMap({"foo": "bar", "baz": "quux", "spam": 37})m.remove("foo") == HashTrieMap({"baz": "quux"})Example 2
Section titled “Example 2”Create a hash trie set
from rpds import HashTrieSet
s = HashTrieSet({"foo", "bar", "baz", "quux"})s.insert("spam") == HashTrieSet({"foo", "bar", "baz", "quux", "spam"})s.remove("foo") == HashTrieSet({"bar", "baz", "quux"})Example 3
Section titled “Example 3”Create a list
from rpds import List
L = List([1, 3, 5])L.push_front(-1) == List([-1, 1, 3, 5])L.rest == List([3, 5])ganymede is made by Eugo