pub struct ProviderRegistry { /* private fields */ }Expand description
The --api-schema name space: ordered name → factory entries.
Ordered so help/error listings are stable; ProviderRegistry::register
replaces in place when the name already exists (letting a downstream binary
override a built-in, e.g. a scripted mock).
Implementations§
Source§impl ProviderRegistry
impl ProviderRegistry
Sourcepub fn new() -> Self
pub fn new() -> Self
An empty registry (no names). Most callers want Self::builtin.
Sourcepub fn builtin() -> Self
pub fn builtin() -> Self
The built-in wires: anthropic, openai-responses, and the keyless
mock (one scripted no-tool text turn → completed, for CI).
Sourcepub fn register<F>(self, name: impl Into<String>, factory: F) -> Self
pub fn register<F>(self, name: impl Into<String>, factory: F) -> Self
Add a provider under name, replacing any existing entry of that name
(registration order is otherwise preserved for listings).
Sourcepub fn build(
&self,
name: &str,
init: &ProviderInit,
) -> Result<BuiltProvider, ProviderBuildError>
pub fn build( &self, name: &str, init: &ProviderInit, ) -> Result<BuiltProvider, ProviderBuildError>
Construct the provider registered under name.
§Errors
ProviderBuildError when name is unknown (the message lists the
available names) or when the factory itself fails (missing env, …).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ProviderRegistry
impl !UnwindSafe for ProviderRegistry
impl Freeze for ProviderRegistry
impl Send for ProviderRegistry
impl Sync for ProviderRegistry
impl Unpin for ProviderRegistry
impl UnsafeUnpin for ProviderRegistry
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