rename generic V -> T. Matches intent better. V is now a larger type that contains T (#19798)

This commit is contained in:
Jeff Washington (jwash) 2021-09-12 10:25:09 -05:00 committed by GitHub
parent d2731a2d93
commit 361101bd31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 7 deletions

View File

@ -10,31 +10,31 @@ type K = Pubkey;
// one instance of this represents one bin of the accounts index.
#[derive(Debug, Default)]
pub struct InMemAccountsIndex<V: IsCached> {
pub struct InMemAccountsIndex<T: IsCached> {
// backing store
map: HashMap<Pubkey, AccountMapEntry<V>>,
map: HashMap<Pubkey, AccountMapEntry<T>>,
}
impl<V: IsCached> InMemAccountsIndex<V> {
impl<T: IsCached> InMemAccountsIndex<T> {
pub fn new() -> Self {
Self {
map: HashMap::new(),
}
}
pub fn entry(&mut self, pubkey: Pubkey) -> Entry<K, AccountMapEntry<V>> {
pub fn entry(&mut self, pubkey: Pubkey) -> Entry<K, AccountMapEntry<T>> {
self.map.entry(pubkey)
}
pub fn items(&self) -> Vec<(K, AccountMapEntry<V>)> {
pub fn items(&self) -> Vec<(K, AccountMapEntry<T>)> {
self.map.iter().map(|(k, v)| (*k, v.clone())).collect()
}
pub fn keys(&self) -> Keys<K, AccountMapEntry<V>> {
pub fn keys(&self) -> Keys<K, AccountMapEntry<T>> {
self.map.keys()
}
pub fn get(&self, key: &K) -> Option<AccountMapEntry<V>> {
pub fn get(&self, key: &K) -> Option<AccountMapEntry<T>> {
self.map.get(key).cloned()
}