Skip to main content

Engine

Trait Engine 

Source
pub trait Engine: Send + Sync {
    // Required method
    fn synthesize(
        &self,
        text: &str,
        voice: &str,
        rate: &str,
        lang: &str,
    ) -> impl Future<Output = Result<Vec<TtsEvent>, TtsError>> + Send;
}
Expand description

A text-to-speech backend.

Implementations must be Send + Sync so the engine can live behind an Arc on a worker thread. The returned future must be Send so it can cross thread boundaries when driven via control channels.

§Arguments

  • text - one utterance (callers chunk longer text; the Edge endpoint caps a single request near ~4 KB).
  • voice - a full voice short-name, e.g. "en-US-EmmaMultilingualNeural".
  • rate - an SSML prosody rate string: "+0%", "+25%", "-10%".
  • lang - BCP-47 language tag for the xml:lang attribute, e.g. "en-US".

Required Methods§

Source

fn synthesize( &self, text: &str, voice: &str, rate: &str, lang: &str, ) -> impl Future<Output = Result<Vec<TtsEvent>, TtsError>> + Send

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§