INNER CODE UNIT · Rust
register
Far-Beyond-Pulsar/Pulsar-Native · crates/agent-providers/agent_chat_core/src/lib.rs:165
pub fn register(&mut self, provider: Arc<dyn ChatProvider>) {
self.providers.insert(provider.id().to_string(), provider);
}
pub fn get(&self, id: &str) -> Option<&Arc<dyn ChatProvider>> {
self.providers.get(id)
}
pub fn contains(&self, id: &str) -> bool {
self.providers.contains_key(id)
}
pub fn remove(&mut self, id: &str) {
self.providers.remove(id);
}
pub fn all(&self) -> impl Iterator<Item = (&String, &Arc<dyn ChatProvider>)> {
self.providers.iter()