pub struct CompressedVectorView<'a> {
pub format_version: u8,
pub config_hash: &'a str,
pub dimension: u32,
pub bit_width: u8,
pub packed_indices: &'a [u8],
pub residual: Option<&'a [u8]>,
}Expand description
A zero-copy view of a single Level-1 serialized CompressedVector.
All fields borrow from the input byte slice. No heap allocation occurs
during parse or
unpack_into.
ⓘ
fn assert_not_serialize<T: serde::Serialize>() {}
assert_not_serialize::<tinyquant_io::CompressedVectorView<'_>>();Fields§
§format_version: u8Format version byte from the Level-1 header.
config_hash: &'a strConfig hash string borrowed from the Level-1 header.
dimension: u32Number of dimensions.
bit_width: u8Bit width (2, 4, or 8).
packed_indices: &'a [u8]Packed index bytes (LSB-first).
residual: Option<&'a [u8]>Residual bytes (2 bytes per dimension), or None.
Implementations§
Source§impl<'a> CompressedVectorView<'a>
impl<'a> CompressedVectorView<'a>
Sourcepub fn unpack_into(&self, out: &mut [u8]) -> Result<(), IoError>
pub fn unpack_into(&self, out: &mut [u8]) -> Result<(), IoError>
Unpack indices into caller-provided buffer (no allocation).
§Errors
Returns IoError::LengthMismatch if out.len() != self.dimension as usize.
Sourcepub fn to_owned_cv(&self) -> Result<CompressedVector, IoError>
pub fn to_owned_cv(&self) -> Result<CompressedVector, IoError>
Allocating escape hatch — copies borrowed bytes into an owned CompressedVector.
§Errors
Returns IoError if unpacking or construction fails.
Auto Trait Implementations§
impl<'a> Freeze for CompressedVectorView<'a>
impl<'a> RefUnwindSafe for CompressedVectorView<'a>
impl<'a> Send for CompressedVectorView<'a>
impl<'a> Sync for CompressedVectorView<'a>
impl<'a> Unpin for CompressedVectorView<'a>
impl<'a> UnsafeUnpin for CompressedVectorView<'a>
impl<'a> UnwindSafe for CompressedVectorView<'a>
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