pub struct TurboQuantPackedCodes { /* private fields */ }Expand description
Row-major packed TurboQuant coordinate codes.
Implementations§
Source§impl TurboQuantPackedCodes
impl TurboQuantPackedCodes
Sourcepub fn new(
bit_width: TurboQuantBitWidth,
dimensions: usize,
rows: usize,
) -> TurboQuantCodecResult<Self>
pub fn new( bit_width: TurboQuantBitWidth, dimensions: usize, rows: usize, ) -> TurboQuantCodecResult<Self>
Allocate zero-filled packed-code storage.
§Errors
Returns an error when dimensions are invalid or the computed byte size
overflows usize.
Sourcepub fn from_bytes(
bit_width: TurboQuantBitWidth,
dimensions: usize,
rows: usize,
bytes: Vec<u8>,
) -> TurboQuantCodecResult<Self>
pub fn from_bytes( bit_width: TurboQuantBitWidth, dimensions: usize, rows: usize, bytes: Vec<u8>, ) -> TurboQuantCodecResult<Self>
Build packed-code storage from existing bytes.
§Errors
Returns an error when dimensions are invalid, the computed byte size
overflows usize, or bytes.len() does not match the expected shape.
Sourcepub const fn bit_width(&self) -> TurboQuantBitWidth
pub const fn bit_width(&self) -> TurboQuantBitWidth
Return the bit width used by the packed codes.
Sourcepub const fn dimensions(&self) -> usize
pub const fn dimensions(&self) -> usize
Return the number of dimensions encoded in each row.
Sourcepub const fn bytes_per_row(&self) -> usize
pub const fn bytes_per_row(&self) -> usize
Return the byte stride for one row, including any trailing padding bits.
Sourcepub fn into_bytes(self) -> Vec<u8> ⓘ
pub fn into_bytes(self) -> Vec<u8> ⓘ
Consume this storage and return the packed backing bytes.
Sourcepub fn estimated_bytes(&self) -> usize
pub fn estimated_bytes(&self) -> usize
Return the packed-code byte footprint.
Sourcepub fn resize_rows(&mut self, rows: usize) -> TurboQuantCodecResult<()>
pub fn resize_rows(&mut self, rows: usize) -> TurboQuantCodecResult<()>
Resize the row count while preserving existing packed rows.
Newly added rows are zero-filled. Shrinking drops trailing rows.
§Errors
Returns an error when the computed byte size overflows usize.
Sourcepub fn read(&self, row: usize, dimension: usize) -> TurboQuantCodecResult<u8>
pub fn read(&self, row: usize, dimension: usize) -> TurboQuantCodecResult<u8>
Read one packed coordinate code.
§Errors
Returns bounds errors when row or dimension is outside the packed
matrix.
Sourcepub fn write(
&mut self,
row: usize,
dimension: usize,
code: u8,
) -> TurboQuantCodecResult<()>
pub fn write( &mut self, row: usize, dimension: usize, code: u8, ) -> TurboQuantCodecResult<()>
Write one packed coordinate code.
§Errors
Returns bounds errors when row or dimension is outside the packed
matrix, and TurboQuantCodecError::InvalidCode when code exceeds
this storage’s bit width.
Trait Implementations§
Source§impl Clone for TurboQuantPackedCodes
impl Clone for TurboQuantPackedCodes
Source§fn clone(&self) -> TurboQuantPackedCodes
fn clone(&self) -> TurboQuantPackedCodes
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TurboQuantPackedCodes
impl Debug for TurboQuantPackedCodes
impl Eq for TurboQuantPackedCodes
Source§impl PartialEq for TurboQuantPackedCodes
impl PartialEq for TurboQuantPackedCodes
Source§fn eq(&self, other: &TurboQuantPackedCodes) -> bool
fn eq(&self, other: &TurboQuantPackedCodes) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for TurboQuantPackedCodes
Auto Trait Implementations§
impl Freeze for TurboQuantPackedCodes
impl RefUnwindSafe for TurboQuantPackedCodes
impl Send for TurboQuantPackedCodes
impl Sync for TurboQuantPackedCodes
impl Unpin for TurboQuantPackedCodes
impl UnsafeUnpin for TurboQuantPackedCodes
impl UnwindSafe for TurboQuantPackedCodes
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.