pub trait Backend: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn capabilities(&self) -> BackendCapabilities;
fn supports(&self, model: &ModelSpec) -> bool;
fn load<'life0, 'life1, 'async_trait>(
&'life0 self,
model: &'life1 ModelSpec,
) -> Pin<Box<dyn Future<Output = RuntimeResult<ModelHandle>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn infer<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
model: &'life1 ModelHandle,
request: &'life2 InferenceRequest,
cancellation: Option<CancellationToken>,
) -> Pin<Box<dyn Future<Output = RuntimeResult<InferenceResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn infer_stream<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
model: &'life1 ModelHandle,
request: &'life2 InferenceRequest,
cancellation: Option<CancellationToken>,
) -> Pin<Box<dyn Future<Output = RuntimeResult<BoxStream<RuntimeResult<InferenceChunk>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
// Provided method
fn infer_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
model: &'life1 ModelHandle,
requests: &'life2 [InferenceRequest],
cancellation: Option<CancellationToken>,
) -> Pin<Box<dyn Future<Output = RuntimeResult<Vec<InferenceResult>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
}Required Methods§
fn name(&self) -> &str
fn capabilities(&self) -> BackendCapabilities
fn supports(&self, model: &ModelSpec) -> bool
fn load<'life0, 'life1, 'async_trait>(
&'life0 self,
model: &'life1 ModelSpec,
) -> Pin<Box<dyn Future<Output = RuntimeResult<ModelHandle>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn infer<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
model: &'life1 ModelHandle,
request: &'life2 InferenceRequest,
cancellation: Option<CancellationToken>,
) -> Pin<Box<dyn Future<Output = RuntimeResult<InferenceResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn infer_stream<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
model: &'life1 ModelHandle,
request: &'life2 InferenceRequest,
cancellation: Option<CancellationToken>,
) -> Pin<Box<dyn Future<Output = RuntimeResult<BoxStream<RuntimeResult<InferenceChunk>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Provided Methods§
fn infer_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
model: &'life1 ModelHandle,
requests: &'life2 [InferenceRequest],
cancellation: Option<CancellationToken>,
) -> Pin<Box<dyn Future<Output = RuntimeResult<Vec<InferenceResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".