Returns a `&[f32]` view of the stored vector for node `id`. Returns `Some` only when the index dtype is `F32`. For `F16` or `BF16` indexes this method returns `None` — use [`Self::get_vector_bytes`] instead and decode via [`crate::dtype::cast_to_f32`] if an f32 view is needed. In debug builds, calling this on a non-F32 index triggers a `debug_assert!` to flag misuse early. In release builds the
(&self, id: u32)
| 214 | /// `debug_assert!` to flag misuse early. In release builds the |
| 215 | /// `debug_assert!` is a no-op and `None` is returned silently. |
| 216 | pub fn get_vector(&self, id: u32) -> Option<&[f32]> { |
| 217 | debug_assert!( |
| 218 | self.params.dtype == VectorStorageDtype::F32, |
| 219 | "get_vector: called on non-F32 index (dtype={}); use get_vector_bytes instead", |
| 220 | self.params.dtype, |
| 221 | ); |
| 222 | self.nodes |
| 223 | .get(id as usize) |
| 224 | .and_then(|n| n.storage.as_f32_slice()) |
| 225 | } |
| 226 | |
| 227 | /// Dtype-agnostic byte view of the stored vector for node `id`. |
| 228 | /// |