Crate weak_table [−] [src]
This library offers a variety of weak hash tables:
-
For a hash map where the keys are held by weak pointers and compared by key value, see
WeakKeyHashMap. -
For a hash map where the keys are held by weak pointers and compared by pointer, see
PtrWeakKeyHashMap. -
For a hash map where the values are held by weak pointers, see
WeakValueHashMap. -
For a hash map where the keys and values are both held by weak pointers and the keys are compared by value, see
WeakWeakHashMap. -
For a hash map where the keys and values are both held by weak pointers and the keys are compared by pointer, see
PtrWeakWeakHashMap. -
For a hash set where the elements are held by weak pointers and compared by element value, see
WeakHashSet. -
For a hash set where the elements are held by weak pointers and compared by pointer, see
PtrWeakHashSet.
Examples
use weak_table::WeakHashSet; use std::sync::{Arc, Weak}; type Table = WeakHashSet<Weak<String>>; let mut set = Table::new(); let a = Arc::new("a".to_string()); let b = Arc::new("b".to_string()); set.insert(a.clone()); assert!( set.contains("a") ); assert!( ! set.contains("b") ); set.insert(b.clone()); assert!( set.contains("a") ); assert!( set.contains("b") ); drop(a); assert!( ! set.contains("a") ); assert!( set.contains("b") );
Modules
| ptr_weak_hash_set |
A hash set where the elements are held by weak pointers and compared by pointer. |
| ptr_weak_key_hash_map |
A hash map where the keys are held by weak pointers and compared by pointer. |
| ptr_weak_weak_hash_map |
A hash map where the keys and values are both held by weak pointers, and keys are compared by pointer. |
| traits |
Traits for describing weak and shared pointers and their use as elements and keys. |
| weak_hash_set |
A hash set where the elements are held by weak pointers and compared by value. |
| weak_key_hash_map |
A hash map where the keys are held by weak pointers and compared by key value. |
| weak_value_hash_map |
A hash map where the values are held by weak pointers. |
| weak_weak_hash_map |
A hash map where the keys and values are both held by weak pointers, and keys are compared by value. |
Structs
| PtrWeakHashSet |
A hash set with weak elements, hashed on element pointer. |
| PtrWeakKeyHashMap |
A hash map with weak keys, hashed on key pointer. |
| PtrWeakWeakHashMap |
A hash map with weak keys and weak values, hashed on key pointer. |
| WeakHashSet |
A hash set with weak elements, hashed on element value. |
| WeakKeyHashMap |
A hash map with weak keys, hashed on key value. |
| WeakValueHashMap |
A hash map with weak values. |
| WeakWeakHashMap |
A hash map with weak keys and weak values, hashed on key value. |