pub struct CodecBackendHandle<B: CodecBackend> { /* private fields */ }Expand description
Typed codec provider — wraps a concrete CodecBackend implementation
and is monomorphized by the compiler. Use this from Rust callers in
hot loops.
Implementations§
Source§impl<B: CodecBackend> CodecBackendHandle<B>
impl<B: CodecBackend> CodecBackendHandle<B>
Sourcepub fn from_arc(backend: Arc<B>) -> Self
pub fn from_arc(backend: Arc<B>) -> Self
Wrap an already-Arc’d backend (lets two providers share one
loaded model instance).
Sourcepub fn into_dyn(self) -> DynCodecProviderwhere
B: 'static,
pub fn into_dyn(self) -> DynCodecProviderwhere
B: 'static,
Erase to a DynCodecProvider for the bindings boundary.
Sourcepub async fn encode_pcm(
&self,
samples: &[f32],
sample_rate: u32,
) -> Result<Vec<u32>, CodecError>
pub async fn encode_pcm( &self, samples: &[f32], sample_rate: u32, ) -> Result<Vec<u32>, CodecError>
Sourcepub async fn decode_tokens(
&self,
tokens: &[u32],
num_codebooks: usize,
) -> Result<Vec<f32>, CodecError>
pub async fn decode_tokens( &self, tokens: &[u32], num_codebooks: usize, ) -> Result<Vec<f32>, CodecError>
Trait Implementations§
Source§impl<B: Clone + CodecBackend> Clone for CodecBackendHandle<B>
impl<B: Clone + CodecBackend> Clone for CodecBackendHandle<B>
Source§fn clone(&self) -> CodecBackendHandle<B>
fn clone(&self) -> CodecBackendHandle<B>
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 moreAuto Trait Implementations§
impl<B> Freeze for CodecBackendHandle<B>
impl<B> RefUnwindSafe for CodecBackendHandle<B>where
B: RefUnwindSafe,
impl<B> Send for CodecBackendHandle<B>
impl<B> Sync for CodecBackendHandle<B>
impl<B> Unpin for CodecBackendHandle<B>
impl<B> UnsafeUnpin for CodecBackendHandle<B>
impl<B> UnwindSafe for CodecBackendHandle<B>where
B: RefUnwindSafe,
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