pub trait ConstructCompletionModel<C>: Sized {
// Required method
fn construct(client: &C, model: String) -> Self;
}Expand description
Construction hook for the blanket CompletionClient implementation over
crate::client::Client.
That blanket implementation is generic over whichever model type a provider
extension declares, so it needs some way to build that model. Coherence
rules out one blanket implementation per provider family — they would all
overlap on Client<Ext, H> — and the alternative of a public bound such as
From<(Client<Ext, H>, String)> would push a synthetic conversion into
every provider model’s public API.
This trait is public because it is the extension point for out-of-tree
provider extensions built on the generic crate::client::Client: such a
crate cannot implement CompletionClient for rig’s foreign
Client<Ext, H> type directly (orphan rule), so it implements this trait
on its own model type instead, and the blanket implementation supplies
completion_model for it. Providers with their own client type simply
implement CompletionClient directly and never need this trait.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".