pub trait BackendAdapter: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn trusts(&self, identity: &ProcessIdentity) -> bool;
fn serve<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
request: &'life1 ServeRequest,
cancel: &'life2 CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<ServerState, BackendError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn ready<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
request: &'life1 ServeRequest,
cancel: &'life2 CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn stop<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
handle: &'life1 ServerState,
cancel: &'life2 CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
// Provided methods
fn attach_only<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_request: &'life1 ServeRequest,
_cancel: &'life2 CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<ServerState, BackendError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn can_embed(&self) -> bool { ... }
fn can_stream(&self) -> bool { ... }
fn chat<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_handle: &'life1 ServerState,
_input: &'life2 ChatInput,
_cancel: &'life3 CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<ChatResult, BackendError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn chat_stream<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
handle: &'life1 ServerState,
input: &'life2 ChatInput,
cancel: &'life3 CancellationToken,
on_delta: &'life4 mut (dyn for<'chunk> FnMut(&'chunk str) + Send),
) -> Pin<Box<dyn Future<Output = Result<ChatResult, BackendError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait { ... }
fn embed<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
_handle: &'life1 ServerState,
_model: &'life2 str,
_inputs: &'life3 [String],
_cancel: &'life4 CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<EmbedResult, BackendError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait { ... }
fn ready_handle<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
request: &'life1 ServeRequest,
_handle: &'life2 ServerState,
cancel: &'life3 CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
}Required Methods§
fn name(&self) -> &'static str
fn trusts(&self, identity: &ProcessIdentity) -> bool
fn serve<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
request: &'life1 ServeRequest,
cancel: &'life2 CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<ServerState, BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn ready<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
request: &'life1 ServeRequest,
cancel: &'life2 CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn stop<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
handle: &'life1 ServerState,
cancel: &'life2 CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Provided Methods§
fn attach_only<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_request: &'life1 ServeRequest,
_cancel: &'life2 CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<ServerState, BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn can_embed(&self) -> bool
fn can_stream(&self) -> bool
fn chat<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_handle: &'life1 ServerState,
_input: &'life2 ChatInput,
_cancel: &'life3 CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<ChatResult, BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn chat_stream<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
handle: &'life1 ServerState,
input: &'life2 ChatInput,
cancel: &'life3 CancellationToken,
on_delta: &'life4 mut (dyn for<'chunk> FnMut(&'chunk str) + Send),
) -> Pin<Box<dyn Future<Output = Result<ChatResult, BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn embed<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
_handle: &'life1 ServerState,
_model: &'life2 str,
_inputs: &'life3 [String],
_cancel: &'life4 CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<EmbedResult, BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn ready_handle<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
request: &'life1 ServeRequest,
_handle: &'life2 ServerState,
cancel: &'life3 CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".