Trait orx_linked_list::MemoryReclaimPolicy
source · pub trait MemoryReclaimPolicy:
Default
+ Clone
+ Copy {
// Required methods
fn reclaim_closed_nodes<'rf, 'a, V, T, P>(
vec_mut: &mut SelfRefColMut<'rf, 'a, V, T, P>,
)
where T: 'a,
V: Variant<'a, T, Storage = NodeDataLazyClose<T>>,
P: PinnedVec<Node<'a, V, T>> + 'a,
SelfRefColMut<'rf, 'a, V, T, P>: Reclaim<<V as Variant<'a, T>>::Prev, <V as Variant<'a, T>>::Next>;
fn at_the_same_state_as(&self, collection: &Self) -> bool;
fn successor_state(&self) -> Self;
}
Expand description
Policy which determines how the memory of closed nodes will be reclaimed and made useful.
Two main implementors are:
MemoryReclaimOnThreshold<N>
reclaims unused holes whenever the utilization of the memory falls below a constant threshold determined byN
. This could be considered as the flexible and general approach.MemoryReclaimNever
which never reclaims the holes due to popped or removed; i.e., closed, nodes. This approach has the advantage that aNodeIndex
is never invalidated due to memory reorganization. Note that it still allows to reclaim closed nodes manually. Therefore, it fits very well to situations where- removals from the list are not substantial, or
- having valid indices is crucial.
Required Methods§
sourcefn reclaim_closed_nodes<'rf, 'a, V, T, P>(
vec_mut: &mut SelfRefColMut<'rf, 'a, V, T, P>,
)where
T: 'a,
V: Variant<'a, T, Storage = NodeDataLazyClose<T>>,
P: PinnedVec<Node<'a, V, T>> + 'a,
SelfRefColMut<'rf, 'a, V, T, P>: Reclaim<<V as Variant<'a, T>>::Prev, <V as Variant<'a, T>>::Next>,
fn reclaim_closed_nodes<'rf, 'a, V, T, P>(
vec_mut: &mut SelfRefColMut<'rf, 'a, V, T, P>,
)where
T: 'a,
V: Variant<'a, T, Storage = NodeDataLazyClose<T>>,
P: PinnedVec<Node<'a, V, T>> + 'a,
SelfRefColMut<'rf, 'a, V, T, P>: Reclaim<<V as Variant<'a, T>>::Prev, <V as Variant<'a, T>>::Next>,
Manually attempts to reclaim closed nodes.
§Safety
Note that reclaiming closed nodes invalidates node indices (NodeIndex
) which are already stored outside of this collection.
sourcefn at_the_same_state_as(&self, collection: &Self) -> bool
fn at_the_same_state_as(&self, collection: &Self) -> bool
Returns whether or not two self referential collections are the same memory state or not.
This method is used internally to check validity of NodeIndex
es.
sourcefn successor_state(&self) -> Self
fn successor_state(&self) -> Self
Provides the state succeeding the current memory state.
Object Safety§
This trait is not object safe.