pub struct ProvidersConfig {
pub providers: Vec<(String, ProviderConfig)>,
}Expand description
The providers configured in ~/.infinity/providers.json: a JSON object
mapping provider id to a ProviderConfig, e.g.:
{
"bedrock": { "command": ["infinity-provider-bedrock"] },
"custom": { "command": ["my-provider", "--flag"], "crate_name": "my-provider" }
}Stored as a Vec of (id, config) pairs because the JSON object’s
insertion order is significant — providers are registered in config
order, and the first model of the first provider is the global default.
Fields§
§providers: Vec<(String, ProviderConfig)>Implementations§
Source§impl ProvidersConfig
impl ProvidersConfig
pub fn get(&self, id: &str) -> Option<&ProviderConfig>
Sourcepub fn upsert(&mut self, id: String, config: ProviderConfig)
pub fn upsert(&mut self, id: String, config: ProviderConfig)
Insert or replace the config for id, preserving its position when
it already exists.
Trait Implementations§
Source§impl Clone for ProvidersConfig
impl Clone for ProvidersConfig
Source§impl Debug for ProvidersConfig
impl Debug for ProvidersConfig
Source§impl Default for ProvidersConfig
impl Default for ProvidersConfig
Source§impl<'de> Deserialize<'de> for ProvidersConfig
impl<'de> Deserialize<'de> for ProvidersConfig
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl Eq for ProvidersConfig
Source§impl PartialEq for ProvidersConfig
impl PartialEq for ProvidersConfig
Source§impl Serialize for ProvidersConfig
impl Serialize for ProvidersConfig
impl StructuralPartialEq for ProvidersConfig
Auto Trait Implementations§
impl Freeze for ProvidersConfig
impl RefUnwindSafe for ProvidersConfig
impl Send for ProvidersConfig
impl Sync for ProvidersConfig
impl Unpin for ProvidersConfig
impl UnsafeUnpin for ProvidersConfig
impl UnwindSafe for ProvidersConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.