Skip to main content

Provide

Trait Provide 

Source
pub trait Provide:
    WasmCompatSend
    + WasmCompatSync
    + 'static {
    // Required method
    fn handler(
        &self,
        spec: &ModelSpec,
        catalog: &Catalog,
        transport: &Transport,
    ) -> Result<ErasedHandler, ConnectError>;
}
Expand description

How a Connector reaches every model of one vendor, in place of the registry’s preset and the environment: a vendor declared at run time (ProviderId::declare) on a gateway of its own, a built-in vendor at another address, or a scripted model in a test.

ConnectOptions is one: the vendor’s models connect with those options (a base URL, a key, an HTTP client, a protocol family). A closure from the spec, the catalog and the transport to a handler is another.

Required Methods§

Source

fn handler( &self, spec: &ModelSpec, catalog: &Catalog, transport: &Transport, ) -> Result<ErasedHandler, ConnectError>

The handler serving spec, a model of catalog. A handler that sends HTTP sends through transport: its shared client, or a client of its own that it wraps.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Provide for ConnectOptions

The vendor’s models connect as Catalog::connect_with connects them with these options, on their HTTP client, else the shared one, wrapped by the transport.

Source§

impl<F> Provide for F