notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit a962d67536341311c73296e7510328c2459cc48f
parent f357935cca316514bddf53c69933316c6574a9bc
Author: kernelkind <kernelkind@gmail.com>
Date:   Tue,  1 Jul 2025 21:44:23 -0400

tmp: temporary AccountCache

will be removed before PR ends

Signed-off-by: kernelkind <kernelkind@gmail.com>

Diffstat:
Mcrates/notedeck/src/account/cache.rs | 18++++++++++++++++++
1 file changed, 18 insertions(+), 0 deletions(-)

diff --git a/crates/notedeck/src/account/cache.rs b/crates/notedeck/src/account/cache.rs @@ -90,6 +90,14 @@ impl AccountCache { .get_mut(&self.selected) .expect("guarenteed that selected exists in accounts") } + + pub fn contains(&self, pk: &[u8; 32]) -> bool { + self.accounts.contains_key(pk) + } + + pub(super) fn iter_mut(&mut self) -> AccountCacheIterMut<'_> { + AccountCacheIterMut(self.accounts.iter_mut()) + } } impl<'a> IntoIterator for &'a AccountCache { @@ -100,3 +108,13 @@ impl<'a> IntoIterator for &'a AccountCache { self.accounts.iter() } } + +pub(super) struct AccountCacheIterMut<'a>(hashbrown::hash_map::IterMut<'a, Pubkey, UserAccount>); + +impl<'a> Iterator for AccountCacheIterMut<'a> { + type Item = (&'a Pubkey, &'a mut UserAccount); + + fn next(&mut self) -> Option<Self::Item> { + self.0.next() + } +}