DefaultCacheableKey

Trait DefaultCacheableKey 

Source
pub trait DefaultCacheableKey: Debug { }
Expand description

Marker trait for types that want to use the default cache key behavior.

Implement this trait for any type that should automatically get a cache key derived from its Debug representation. This is the simplest way to make a type cacheable.

§Examples

use cachelito_core::DefaultCacheableKey;

#[derive(Debug, Clone)]
struct Product {
    id: u32,
    name: String,
}

// Enable default cache key generation based on Debug
impl DefaultCacheableKey for Product {}

§Note

Types implementing this trait must also implement Debug, as the default cache key is generated using format!("{:?}", value).

Implementations on Foreign Types§

Source§

impl DefaultCacheableKey for &str

Source§

impl DefaultCacheableKey for bool

Source§

impl DefaultCacheableKey for char

Source§

impl DefaultCacheableKey for f32

Source§

impl DefaultCacheableKey for f64

Source§

impl DefaultCacheableKey for i8

Source§

impl DefaultCacheableKey for i16

Source§

impl DefaultCacheableKey for i32

Source§

impl DefaultCacheableKey for i64

Source§

impl DefaultCacheableKey for i128

Source§

impl DefaultCacheableKey for isize

Source§

impl DefaultCacheableKey for u8

Source§

impl DefaultCacheableKey for u16

Source§

impl DefaultCacheableKey for u32

Source§

impl DefaultCacheableKey for u64

Source§

impl DefaultCacheableKey for u128

Source§

impl DefaultCacheableKey for usize

Source§

impl DefaultCacheableKey for String

Source§

impl<T1: DefaultCacheableKey> DefaultCacheableKey for (T1,)

Source§

impl<T1: DefaultCacheableKey, T2: DefaultCacheableKey> DefaultCacheableKey for (T1, T2)

Source§

impl<T1: DefaultCacheableKey, T2: DefaultCacheableKey, T3: DefaultCacheableKey> DefaultCacheableKey for (T1, T2, T3)

Source§

impl<T1: DefaultCacheableKey, T2: DefaultCacheableKey, T3: DefaultCacheableKey, T4: DefaultCacheableKey> DefaultCacheableKey for (T1, T2, T3, T4)

Source§

impl<T1: DefaultCacheableKey, T2: DefaultCacheableKey, T3: DefaultCacheableKey, T4: DefaultCacheableKey, T5: DefaultCacheableKey> DefaultCacheableKey for (T1, T2, T3, T4, T5)

Source§

impl<T: DefaultCacheableKey> DefaultCacheableKey for &[T]

Source§

impl<T: DefaultCacheableKey> DefaultCacheableKey for Option<T>

Source§

impl<T: DefaultCacheableKey> DefaultCacheableKey for Vec<T>

Implementors§