pub struct RingDbConfig {
pub dims: usize,
pub backend_preference: BackendPreference,
pub persist_dir: Option<PathBuf>,
}Expand description
Configuration for a RingDb instance.
Fields§
§dims: usizeNumber of dimensions per vector. Must be > 0.
backend_preference: BackendPreferenceBackend selection strategy.
persist_dir: Option<PathBuf>Optional directory for persisting the database.
When set, RingDb::build() writes the
full database (vectors, norms, payloads, offsets, and metadata) to this
directory. The sealed database can later be reloaded with
RingDb::load().
Leave None (the default) for a purely in-memory database.
Implementations§
Source§impl RingDbConfig
impl RingDbConfig
Sourcepub fn new(dims: usize) -> Self
pub fn new(dims: usize) -> Self
Create a config with default settings (CPU backend, no persistence).
Sourcepub fn with_persist_dir(self, dir: impl Into<PathBuf>) -> Self
pub fn with_persist_dir(self, dir: impl Into<PathBuf>) -> Self
Sourcepub fn with_backend_preference(self, preference: BackendPreference) -> Self
pub fn with_backend_preference(self, preference: BackendPreference) -> Self
Set the backend preference.
Defaults to BackendPreference::Cpu. Use this when loading a
persisted database onto a specific backend via RingDb::load().
§Example
use ringdb::RingDbConfig;
use ringdb::BackendPreference;
let config = RingDbConfig::new(128).with_backend_preference(BackendPreference::Cpu);Trait Implementations§
Source§impl Clone for RingDbConfig
impl Clone for RingDbConfig
Source§fn clone(&self) -> RingDbConfig
fn clone(&self) -> RingDbConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RingDbConfig
impl RefUnwindSafe for RingDbConfig
impl Send for RingDbConfig
impl Sync for RingDbConfig
impl Unpin for RingDbConfig
impl UnsafeUnpin for RingDbConfig
impl UnwindSafe for RingDbConfig
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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