orx_selfref_col/memory/
never.rs

1use super::policy::MemoryPolicy;
2use crate::{CoreCol, Node, NodePtr, Variant};
3use orx_pinned_vec::PinnedVec;
4
5/// A do-nothing `MemoryReclaimPolicy` which would never reclaim the memory of the closed nodes, leaving them as holes in the underlying storage.
6///
7/// This approach has the advantage that a `NodeIndex` is never invalidated due to an automatic memory reorganization.
8///
9/// Furthermore, node utilization can still be maximized by manually calling `reclaim_closed_nodes` method.
10#[derive(Default, Clone, Copy)]
11pub struct MemoryReclaimNever;
12
13impl<V: Variant> MemoryPolicy<V> for MemoryReclaimNever {
14    #[inline(always)]
15    fn reclaim_closed_nodes<P>(_col: &mut CoreCol<V, P>, _closed_node_ptr: &NodePtr<V>) -> bool
16    where
17        P: PinnedVec<Node<V>>,
18    {
19        false
20    }
21}