vecdb 0.10.2

High-performance mutable persistent vectors built on rawdb
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::ValueStrategy;

/// Strategy for raw (uncompressed) storage vectors.
///
/// Extends `ValueStrategy` with fast pointer-based reads used by mmap/IO iterators.
pub trait RawStrategy<T>: ValueStrategy<T> {
    /// Reads a single T from a raw byte pointer at the given byte offset.
    ///
    /// For native-layout types, this compiles to a single `mov` instruction,
    /// bypassing slice creation, bounds checking, and Result overhead.
    ///
    /// # Safety
    /// - `ptr.add(byte_offset)` must be valid for reading `size_of::<T>()` bytes.
    /// - The bytes at that location must be a valid serialized T.
    unsafe fn read_from_ptr(ptr: *const u8, byte_offset: usize) -> T;
}