Batch encode all vectors into a contiguous byte array. Charges `m * vectors.len()` bytes to the governor budget (if set) before allocating the output buffer. The guard is released at the end of this call — the buffer itself remains alive.
(&self, vectors: &[&[f32]])
| 138 | /// before allocating the output buffer. The guard is released at |
| 139 | /// the end of this call — the buffer itself remains alive. |
| 140 | pub fn encode_batch(&self, vectors: &[&[f32]]) -> Result<Vec<u8>, VectorError> { |
| 141 | let capacity = self.m * vectors.len(); |
| 142 | let _g = try_reserve_or_skip(&self.governor, capacity * size_of::<u8>())?; |
| 143 | let mut out = Vec::with_capacity(capacity); |
| 144 | for v in vectors { |
| 145 | out.extend(self.encode(v)); |
| 146 | } |
| 147 | Ok(out) |
| 148 | } |
| 149 | |
| 150 | /// Build an asymmetric distance table for a query vector. |
| 151 | /// |