jwt_next/algorithm/
store.rs1use std::borrow::Borrow;
2use std::collections::{BTreeMap, HashMap};
3use std::hash::Hash;
4
5pub trait Store {
7 type Algorithm: ?Sized;
8
9 fn get(&self, key_id: &str) -> Option<&Self::Algorithm>;
10}
11
12impl<K, A> Store for BTreeMap<K, A>
13where
14 K: Borrow<str> + Ord,
15{
16 type Algorithm = A;
17
18 fn get(&self, key_id: &str) -> Option<&A> {
19 BTreeMap::get(self, key_id)
20 }
21}
22
23impl<K, A> Store for HashMap<K, A>
24where
25 K: Borrow<str> + Ord + Hash,
26{
27 type Algorithm = A;
28
29 fn get(&self, key_id: &str) -> Option<&A> {
30 HashMap::get(self, key_id)
31 }
32}