pub trait LlmLayer {
type Provider: LlmProvider;
// Required method
fn layer(self, inner: Arc<dyn LlmProvider>) -> Self::Provider;
}Expand description
Wraps an inner LlmProvider in a new one, adding cross-cutting behaviour.
Analogous to tower::Layer, but specialised to the LLM provider trait so
that wrapped providers remain LlmProviders — no Service<Request> generic
gymnastics or sprawling where clauses. Each layer’s output is itself a
provider, so layers compose freely and the result is a single
Arc<dyn LlmProvider>.
Required Associated Types§
Sourcetype Provider: LlmProvider
type Provider: LlmProvider
The provider produced by wrapping inner.
Required Methods§
Sourcefn layer(self, inner: Arc<dyn LlmProvider>) -> Self::Provider
fn layer(self, inner: Arc<dyn LlmProvider>) -> Self::Provider
Wrap inner, returning the decorated provider.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".