Skip to main content

RealtimeFactory

Trait RealtimeFactory 

Source
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§

Source

fn provider(&self) -> &ProviderId

Provider identifier.

Source

fn model(&self, model_id: &str) -> Result<RealtimeModelRef, NoSuchModelError>

Returns the realtime model with model_id.

§Errors

Returns NoSuchModelError when the model is unknown.

Source

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".

Implementors§