pub struct PreparedCodec { /* private fields */ }Expand description
Pre-built compress/decompress session.
Construct once with PreparedCodec::new, then pass to
[Codec::compress_prepared] / [Codec::decompress_prepared_into]
for each vector. The RotationMatrix inside is computed exactly once.
Implementations§
Source§impl PreparedCodec
impl PreparedCodec
Sourcepub fn new(config: CodecConfig, codebook: Codebook) -> Result<Self, CodecError>
pub fn new(config: CodecConfig, codebook: Codebook) -> Result<Self, CodecError>
Build from a validated config and trained codebook.
The rotation matrix is computed exactly once.
§Errors
CodecError::CodebookIncompatible if codebook.bit_width() != config.bit_width().
Sourcepub const fn config(&self) -> &CodecConfig
pub const fn config(&self) -> &CodecConfig
The CodecConfig that defines this session.
Sourcepub const fn rotation(&self) -> &RotationMatrix
pub const fn rotation(&self) -> &RotationMatrix
The pre-built RotationMatrix — computed once at construction.
Sourcepub fn set_gpu_state(&mut self, state: Box<dyn Any + Send + Sync>)
pub fn set_gpu_state(&mut self, state: Box<dyn Any + Send + Sync>)
Attach opaque GPU state.
Called by GPU backends — do not call from application code.
Sourcepub fn has_gpu_state(&self) -> bool
pub fn has_gpu_state(&self) -> bool
true if a GPU backend has attached device-resident state.
Auto Trait Implementations§
impl Freeze for PreparedCodec
impl !RefUnwindSafe for PreparedCodec
impl Send for PreparedCodec
impl Sync for PreparedCodec
impl Unpin for PreparedCodec
impl UnsafeUnpin for PreparedCodec
impl !UnwindSafe for PreparedCodec
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