Make conversation store easier to use

This commit is contained in:
Jazz Turner-Baggs 2026-02-06 13:11:18 -08:00
parent ff15da63a1
commit 0b8682fac8
No known key found for this signature in database

View File

@ -50,16 +50,12 @@ impl ConversationStore {
self.conversations.contains_key(id) self.conversations.contains_key(id)
} }
pub fn get(&self, id: ConversationId) -> Option<&(dyn Convo + '_)> {
self.conversations.get(id).map(|c| c.as_ref())
}
pub fn get_mut(&mut self, id: &str) -> Option<&mut (dyn Convo + '_)> { pub fn get_mut(&mut self, id: &str) -> Option<&mut (dyn Convo + '_)> {
Some(self.conversations.get_mut(id)?.as_mut()) Some(self.conversations.get_mut(id)?.as_mut())
} }
pub fn conversation_ids(&self) -> impl Iterator<Item = ConversationIdOwned> + '_ { pub fn conversation_ids(&self) -> Vec<ConversationIdOwned> {
self.conversations.keys().cloned() self.conversations.keys().cloned().collect()
} }
} }