pub struct Auto;
Expand description
The Auto
policy reclaims closed nodes whenever the utilization falls below 75%.
- The default policy; and hence, the generic parameter can be omitted.
- It automatically reclaims memory whenever the utilization falls below 75%.
- Automatic triggers of memory reclaims might lead to implicit invalidation of node indices due to
ReorganizedCollection
. - It is important to note that, even when using Auto policy, tree growth will never trigger memory reclaim.
Only node removing mutations such as
prune
can trigger node reorganization.
Compared to Lazy
, auto approach has the following pros & cons:
- (+) Node indices (
NodeIdx<V>
) created for an auto-reclaim tree will can be implicitly invalidated. Recall that, analogous to random access to an array element with its index, node indices allow for constant time access to the corresponding node. A node index can be invalidated if either of the following happens (i) the node is removed from the tree, (ii) other nodes are removed from the tree triggering a memory reclaim operation. With auto policy, both the explicit (i) and implicit (ii) invalidation can occur. - (-) Uses memory efficiently making sure that utilization can never go below a constant threshold.
Since Auto is the default memory policy, we do not need to include it in the tree type signature.
In order to observe the impact of the memory reclaim policy on validity of the node indices,
please see the Examples section of MemoryPolicy
.
Trait Implementationsยง
Sourceยงimpl MemoryPolicy for Auto
impl MemoryPolicy for Auto
Sourceยงtype MemoryReclaimPolicy<V> = MemoryReclaimOnThreshold<2, V, <V as TreeVariant>::Reclaimer>
where
V: TreeVariant
type MemoryReclaimPolicy<V> = MemoryReclaimOnThreshold<2, V, <V as TreeVariant>::Reclaimer> where V: TreeVariant
Memory reclaim policy for the specific tree variant
V
.Auto Trait Implementationsยง
impl Freeze for Auto
impl RefUnwindSafe for Auto
impl Send for Auto
impl Sync for Auto
impl Unpin for Auto
impl UnwindSafe for Auto
Blanket Implementationsยง
Sourceยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Sourceยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more