pub struct MockAdapter { /* private fields */ }Expand description
Minimal adapter used in tests. Delegates AsrEngine calls to a
deterministic in-memory implementation.
Implementations§
Source§impl MockAdapter
impl MockAdapter
Sourcepub fn new(family: EngineFamily) -> Self
pub fn new(family: EngineFamily) -> Self
Build a CPU-backed, English+Spanish, multilingual mock adapter
for family. Use the builder helpers to override the defaults.
Sourcepub fn with_backend(self, backend: BackendKind) -> Self
pub fn with_backend(self, backend: BackendKind) -> Self
Swap the backend kind (e.g. to exercise cuda code paths in
the adapter contract).
Sourcepub fn with_capabilities(self, caps: ModelCapabilities) -> Self
pub fn with_capabilities(self, caps: ModelCapabilities) -> Self
Override the ModelCapabilities advertised by the mock.
Trait Implementations§
Source§impl AsrEngine for MockAdapter
impl AsrEngine for MockAdapter
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]).Source§impl Clone for MockAdapter
impl Clone for MockAdapter
Source§fn clone(&self) -> MockAdapter
fn clone(&self) -> MockAdapter
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MockAdapter
impl Debug for MockAdapter
Source§impl EngineAdapter for MockAdapter
impl EngineAdapter for MockAdapter
Source§fn family(&self) -> EngineFamily
fn family(&self) -> EngineFamily
Which engine family this adapter represents.
Source§fn info(&self) -> EngineInfo
fn info(&self) -> EngineInfo
Static metadata about the loaded engine.
Source§fn backend(&self) -> BackendDescriptor
fn backend(&self) -> BackendDescriptor
Hardware backend the engine was loaded with.
Source§fn as_asr_engine(&self) -> &dyn AsrEngine
fn as_asr_engine(&self) -> &dyn AsrEngine
Source§fn as_streaming_engine(&self) -> Option<&dyn StreamingAsrEngine>
fn as_streaming_engine(&self) -> Option<&dyn StreamingAsrEngine>
Returns
Some(&dyn StreamingAsrEngine) if the underlying
engine supports streaming, None otherwise. Read moreAuto Trait Implementations§
impl Freeze for MockAdapter
impl RefUnwindSafe for MockAdapter
impl Send for MockAdapter
impl Sync for MockAdapter
impl Unpin for MockAdapter
impl UnsafeUnpin for MockAdapter
impl UnwindSafe for MockAdapter
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