Capacity

Trait Capacity 

Source
pub trait Capacity {
    const CAPACITY: usize;
}
Expand description

A constant cache capacity.

§Provided Capacity Implementations

This crate defines all power-of-two capacities up to 8192 as associative_cache::CapacityN.

use associative_cache::Capacity256;

§Defining Custom Cache Capacities

You may implement this trait yourself to define your own custom cache capacities:

use associative_cache::Capacity;

pub struct Capacity42;

impl Capacity for Capacity42 {
    const CAPACITY: usize = 42;
}

Required Associated Constants§

Source

const CAPACITY: usize

The constant capacity for a cache.

Must be greater than zero.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§