pub struct CodecConfig { /* private fields */ }Expand description
Immutable configuration snapshot that fully determines codec behavior.
Two configs with identical primary fields are interchangeable. The
cached config_hash is computed eagerly in CodecConfig::new and
ignored by PartialEq / Hash so semantically equal configs
compare equal regardless of which instance owns the Arc<str>.
Implementations§
Source§impl CodecConfig
impl CodecConfig
Sourcepub fn new(
bit_width: u8,
seed: u64,
dimension: u32,
residual_enabled: bool,
) -> Result<Self, CodecError>
pub fn new( bit_width: u8, seed: u64, dimension: u32, residual_enabled: bool, ) -> Result<Self, CodecError>
Validate the field invariants and return a new CodecConfig.
§Errors
CodecError::UnsupportedBitWidth—bit_widthis not inSUPPORTED_BIT_WIDTHS.CodecError::InvalidDimension—dimension == 0.
Sourcepub const fn seed(&self) -> u64
pub const fn seed(&self) -> u64
The seed used for deterministic rotation and codebook generation.
Sourcepub const fn residual_enabled(&self) -> bool
pub const fn residual_enabled(&self) -> bool
Whether stage-2 residual correction is enabled.
Sourcepub const fn num_codebook_entries(&self) -> u32
pub const fn num_codebook_entries(&self) -> u32
2^bit_width — the number of quantization levels in the codebook.
Sourcepub const fn config_hash(&self) -> &ConfigHash
pub const fn config_hash(&self) -> &ConfigHash
Cached SHA-256 hex digest of the canonical string representation.
Returned as an Arc<str> borrow; clone with .clone() for owned use.
Trait Implementations§
Source§impl Clone for CodecConfig
impl Clone for CodecConfig
Source§fn clone(&self) -> CodecConfig
fn clone(&self) -> CodecConfig
Returns a duplicate of the value. Read more
1.0.0 · 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 CodecConfig
impl Debug for CodecConfig
Source§impl Hash for CodecConfig
impl Hash for CodecConfig
Source§impl PartialEq for CodecConfig
impl PartialEq for CodecConfig
impl Eq for CodecConfig
Auto Trait Implementations§
impl Freeze for CodecConfig
impl RefUnwindSafe for CodecConfig
impl Send for CodecConfig
impl Sync for CodecConfig
impl Unpin for CodecConfig
impl UnsafeUnpin for CodecConfig
impl UnwindSafe for CodecConfig
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