[][src]Struct associative_cache::replacement::RandomReplacement

pub struct RandomReplacement<R = StdRng> { /* fields omitted */ }

Choose a random cache entry to replace.

When considering n items to potentially replace, choose one at random.

Requires the "rand" feature to be enabled.

Methods

impl<R> RandomReplacement<R>[src]

pub fn with_rng(rng: R) -> Self[src]

Construct a RandomReplacement with the given random number generator.

Example

use associative_cache::*;
use rand::{rngs::StdRng, SeedableRng};

let rng = StdRng::seed_from_u64(42);
let policy = RandomReplacement::with_rng(rng);

Trait Implementations

impl<V, C, R> Replacement<V, C> for RandomReplacement<R> where
    C: Capacity,
    R: Rng
[src]

impl<R: Clone> Clone for RandomReplacement<R>[src]

impl Default for RandomReplacement<StdRng>[src]

impl<R: PartialOrd> PartialOrd<RandomReplacement<R>> for RandomReplacement<R>[src]

impl<R: Eq> Eq for RandomReplacement<R>[src]

impl<R: Ord> Ord for RandomReplacement<R>[src]

impl<R: PartialEq> PartialEq<RandomReplacement<R>> for RandomReplacement<R>[src]

impl<R: Debug> Debug for RandomReplacement<R>[src]

impl<R: Hash> Hash for RandomReplacement<R>[src]

Auto Trait Implementations

impl<R> Send for RandomReplacement<R> where
    R: Send

impl<R> Sync for RandomReplacement<R> where
    R: Sync

impl<R> Unpin for RandomReplacement<R> where
    R: Unpin

impl<R> RefUnwindSafe for RandomReplacement<R> where
    R: RefUnwindSafe

impl<R> UnwindSafe for RandomReplacement<R> where
    R: UnwindSafe

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,