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() -> ProviderRegistry
pub fn new() -> ProviderRegistry
An empty registry (no names). Most callers want Self::builtin.
Sourcepub fn builtin() -> ProviderRegistry
pub fn builtin() -> ProviderRegistry
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,
) -> ProviderRegistry
pub fn register<F>( self, name: impl Into<String>, factory: F, ) -> ProviderRegistry
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§
Source§impl Default for ProviderRegistry
impl Default for ProviderRegistry
Source§fn default() -> ProviderRegistry
fn default() -> ProviderRegistry
Returns the “default value” for a type. Read more
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