Skip to main content

EvictionPolicy

Trait EvictionPolicy 

Source
pub trait EvictionPolicy: Send + Sync {
    // Required method
    fn select_evictions(
        &self,
        ctx: &EvictionContext<'_>,
    ) -> Vec<CapsuleIdentity>;
}
Expand description

Chooses which capsules to evict to make room. See the module docs for the pinned invariant.

Required Methods§

Source

fn select_evictions(&self, ctx: &EvictionContext<'_>) -> Vec<CapsuleIdentity>

Return the capsules to evict (in eviction order) to satisfy EvictionContext::bytes_to_free. MUST NOT include a pinned entry. Returning too few is allowed — the cache then admits over capacity (only pins can force that), which is the caller’s explicit choice.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§