Struct Auto

Source
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

Sourceยง

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ยง

Blanket Implementationsยง

Sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

Sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

Sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

Sourceยง

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Sourceยง

impl<T> SoM<T> for T

Sourceยง

fn get_ref(&self) -> &T

Returns a reference to self.
Sourceยง

fn get_mut(&mut self) -> &mut T

Returns a mutable reference to self.
Sourceยง

impl<T> SoR<T> for T

Sourceยง

fn get_ref(&self) -> &T

Returns a reference to self.
Sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Sourceยง

type Error = Infallible

The type returned in the event of a conversion error.
Sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Sourceยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.