mirror of
https://github.com/logos-messaging/libchat.git
synced 2026-02-10 08:53:08 +00:00
Make conversation store easier to use
This commit is contained in:
parent
45b54bf983
commit
b39b418986
@ -50,16 +50,12 @@ impl ConversationStore {
|
||||
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 + '_)> {
|
||||
Some(self.conversations.get_mut(id)?.as_mut())
|
||||
}
|
||||
|
||||
pub fn conversation_ids(&self) -> impl Iterator<Item = ConversationIdOwned> + '_ {
|
||||
self.conversations.keys().cloned()
|
||||
pub fn conversation_ids(&self) -> Vec<ConversationIdOwned> {
|
||||
self.conversations.keys().cloned().collect()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user