Skip to main content

CacheStack

Trait CacheStack 

Source
pub trait CacheStack: Sized {
    type Cache;

    // Required methods
    fn slot_count(&self) -> usize;
    fn into_slots(self) -> Vec<Option<Self::Cache>>;
    fn from_slots(slots: Vec<Option<Self::Cache>>) -> Self;
}
Expand description

The uniform interface a per-network cache collection exposes for the generic Layers loop. The existing Mamba{1,2,3}Caches already provide it (under caches_len/into_options/from_options).

Required Associated Types§

Source

type Cache

The per-layer cache element.

Required Methods§

Source

fn slot_count(&self) -> usize

Number of per-(virtual-)layer slots.

Source

fn into_slots(self) -> Vec<Option<Self::Cache>>

Move each slot into an Option so the loop can take without cloning.

Source

fn from_slots(slots: Vec<Option<Self::Cache>>) -> Self

Inverse of Self::into_slots.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§