pub trait RealtimeFactory:
Send
+ Sync
+ 'static {
// Required methods
fn provider(&self) -> &ProviderId;
fn model(
&self,
model_id: &str,
) -> Result<RealtimeModelRef, NoSuchModelError>;
fn get_token(
&self,
options: GetTokenOptions,
) -> impl Future<Output = Result<ClientSecret, ProviderError>> + Send;
}Expand description
Creates realtime models and session tokens for a provider.
Required Methods§
Sourcefn provider(&self) -> &ProviderId
fn provider(&self) -> &ProviderId
Provider identifier.
Sourcefn model(&self, model_id: &str) -> Result<RealtimeModelRef, NoSuchModelError>
fn model(&self, model_id: &str) -> Result<RealtimeModelRef, NoSuchModelError>
Returns the realtime model with model_id.
§Errors
Returns NoSuchModelError when the model is unknown.
Sourcefn get_token(
&self,
options: GetTokenOptions,
) -> impl Future<Output = Result<ClientSecret, ProviderError>> + Send
fn get_token( &self, options: GetTokenOptions, ) -> impl Future<Output = Result<ClientSecret, ProviderError>> + Send
Creates a session token for options.model.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".