pub trait BackendFactory: Send + Sync {
// Required methods
fn provider(&self) -> &'static str;
fn describe(&self) -> &'static str;
fn build(&self, target: &str) -> Result<Arc<dyn InferBackend>>;
}Expand description
Builds one kind of InferBackend from a spec’s model target.
Required Methods§
Sourcefn describe(&self) -> &'static str
fn describe(&self) -> &'static str
One line describing what this serves, shown when resolution fails.
Sourcefn build(&self, target: &str) -> Result<Arc<dyn InferBackend>>
fn build(&self, target: &str) -> Result<Arc<dyn InferBackend>>
Build a backend for target, whose meaning is this provider’s own: a
model tag, a filesystem path, a URL.
Returning an error here should mean the target is unusable — malformed, or naming something that cannot exist. Whether the service is reachable is deliberately not checked: that would make constructing a backend fallible for reasons that change minute to minute, and the failure is better reported when a job actually runs, where it lands in that job’s envelope instead of preventing the daemon from starting.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".