rspace_traits/store.rs
1/*
2 Appellation: key_value <module>
3 Created At: 2025.12.26:17:44:22
4 Contrib: @FL03
5*/
6//! this module defines traits for key-value stores and their entries
7//!
8
9/// [`StoreEntry`] establishes a common interface for entries within a key-value store.
10pub trait StoreEntry<'a> {
11 type Key;
12 type Value;
13}
14/// The [`RawStore`] trait is a marker trait for key-value store containers.
15pub trait RawStore<K, V> {}
16/// The [`Store`] trait is used to define a key-value store container.
17pub trait Store<K, V>: RawStore<K, V> {
18 type Entry<'a>: StoreEntry<'a, Key = K, Value = V>
19 where
20 Self: 'a;
21}
22
23/*
24 ************* Implementations *************
25*/
26
27impl<K, V, S> RawStore<K, V> for &S where S: RawStore<K, V> {}
28
29impl<K, V, S> RawStore<K, V> for &mut S where S: RawStore<K, V> {}