Skip to main content

VecqView

Struct VecqView 

Source
pub struct VecqView<'a> { /* private fields */ }
Expand description

Read-only, zero-copy view over an index file (or any bytes in the same layout). Generic over the byte owner’s lifetime.

Implementations§

Source§

impl<'a> VecqView<'a>

Source

pub fn from_bytes(bytes: &'a [u8]) -> Result<Self, Error>

Parse bytes as a vecq index file (v1.2+) without copying payloads. v1 files (f32 scales) are not view-eligible: their scale blocks are not the 2-byte layout shared by every current writer.

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn dim(&self) -> usize

Source

pub fn working_dim(&self) -> usize

Source

pub fn bits(&self) -> u8

Code width of the viewed file (4, 5, or 6 bits).

Source

pub fn is_residual(&self) -> bool

Whether the file carries a residual second pass (v1.4).

Source

pub fn prepare_query(&self, q: &[f32]) -> ViewQuery

Prepare a query: truncate to working_dim, normalize, rotate, then normalize again — mirroring the index-side prepare_query exactly so both paths see identical rotated queries.

Source

pub fn score(&self, pq: &ViewQuery, idx: usize) -> f32

Asymmetric score of vector idx — same kernel dispatch and association order as crate::store::VecqIndex::score.

Source

pub fn search(&self, q: &[f32], k: usize) -> Vec<(usize, f32)>

Brute-force top-k over the borrowed codes — same bounded heap, key encoding, batched kernel dispatch, and output ordering as crate::store::VecqIndex::search.

Auto Trait Implementations§

§

impl<'a> Freeze for VecqView<'a>

§

impl<'a> RefUnwindSafe for VecqView<'a>

§

impl<'a> Send for VecqView<'a>

§

impl<'a> Sync for VecqView<'a>

§

impl<'a> Unpin for VecqView<'a>

§

impl<'a> UnsafeUnpin for VecqView<'a>

§

impl<'a> UnwindSafe for VecqView<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.