pub struct BatchVectorAllocator { /* private fields */ }Expand description
Batch vector allocator for processing multiple vectors (ADR-001)
Allocates contiguous, cache-aligned storage for a batch of vectors, enabling efficient SIMD processing and minimal cache misses.
Implementations§
Source§impl BatchVectorAllocator
impl BatchVectorAllocator
Sourcepub fn new(dimensions: usize, initial_capacity: usize) -> Self
pub fn new(dimensions: usize, initial_capacity: usize) -> Self
Create allocator for vectors of given dimensions
§Panics
Panics if memory allocation fails. For fallible allocation,
use try_new.
Sourcepub fn try_new(dimensions: usize, initial_capacity: usize) -> Option<Self>
pub fn try_new(dimensions: usize, initial_capacity: usize) -> Option<Self>
Try to create allocator for vectors of given dimensions
Returns None if memory allocation fails.
Sourcepub fn add(&mut self, vector: &[f32]) -> usize
pub fn add(&mut self, vector: &[f32]) -> usize
Add a vector, returns its index
§Panics
Panics if the allocator is full, dimensions mismatch, or allocator has zero capacity.
Sourcepub fn dimensions(&self) -> usize
pub fn dimensions(&self) -> usize
Dimensions per vector
Trait Implementations§
Source§impl Drop for BatchVectorAllocator
impl Drop for BatchVectorAllocator
impl Send for BatchVectorAllocator
impl Sync for BatchVectorAllocator
Auto Trait Implementations§
impl Freeze for BatchVectorAllocator
impl RefUnwindSafe for BatchVectorAllocator
impl Unpin for BatchVectorAllocator
impl UnwindSafe for BatchVectorAllocator
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more