pub struct AnyEngine { /* private fields */ }Expand description
Type-erased wrapper around an EngineAdapter.
Lets voxora-registry and voxora-bridge store heterogeneous
engines behind a single type. The wrapper is Clone because the
inner Arc is.
Implementations§
Source§impl AnyEngine
impl AnyEngine
Sourcepub fn new<A: EngineAdapter + 'static>(adapter: A) -> Self
pub fn new<A: EngineAdapter + 'static>(adapter: A) -> Self
Wrap an adapter behind Arc and return a Clone-able handle.
Sourcepub fn family(&self) -> EngineFamily
pub fn family(&self) -> EngineFamily
Engine family of the wrapped adapter.
Sourcepub fn info(&self) -> EngineInfo
pub fn info(&self) -> EngineInfo
Static metadata for the wrapped engine.
Sourcepub fn backend(&self) -> BackendDescriptor
pub fn backend(&self) -> BackendDescriptor
Backend the wrapped engine was loaded with.
Sourcepub fn as_asr_engine(&self) -> &dyn AsrEngine
pub fn as_asr_engine(&self) -> &dyn AsrEngine
Borrow the underlying ASR engine trait object.
Sourcepub fn as_streaming_engine(&self) -> Option<&dyn StreamingAsrEngine>
pub fn as_streaming_engine(&self) -> Option<&dyn StreamingAsrEngine>
Borrow the streaming engine trait object when the underlying
adapter advertises one. Returns None for whole-buffer-only
engines (today: every engine in the workspace).
Sourcepub fn as_engine_adapter(&self) -> &dyn EngineAdapter
pub fn as_engine_adapter(&self) -> &dyn EngineAdapter
Borrow the inner adapter trait object.
Trait Implementations§
Source§impl AsrEngine for AnyEngine
impl AsrEngine for AnyEngine
Source§fn capabilities(&self) -> ModelCapabilities
fn capabilities(&self) -> ModelCapabilities
What this engine supports. Defaults to
ModelCapabilities::UNKNOWN
so implementors only override what they know.Source§fn transcribe(
&self,
samples: &[f32],
opts: &TranscribeOptions,
) -> Result<TranscriptionResult, AsrError>
fn transcribe( &self, samples: &[f32], opts: &TranscribeOptions, ) -> Result<TranscriptionResult, AsrError>
Transcribe a buffer of mono PCM samples at the engine’s expected
sample rate (typically 16 kHz, f32 in
[-1.0, 1.0]).Auto Trait Implementations§
impl !RefUnwindSafe for AnyEngine
impl !UnwindSafe for AnyEngine
impl Freeze for AnyEngine
impl Send for AnyEngine
impl Sync for AnyEngine
impl Unpin for AnyEngine
impl UnsafeUnpin for AnyEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more