pub enum BackendConfig {
Redb {
path: String,
},
InMemory,
}Expand description
Configuration for selecting and building a backend.
This enum provides a unified way to configure different storage backends. Each variant contains the necessary configuration for its respective backend.
§Example
use index::BackendConfig;
// In-memory (for testing)
let config = BackendConfig::in_memory();
// Redb (pure Rust, recommended)
let config = BackendConfig::redb("/data/ucfp.redb");Variants§
Redb
Use Redb for storage. The path is the file path for the database.
Redb is a pure Rust embedded database that doesn’t require C++ dependencies. This is the recommended backend for most deployments.
Requires the backend-redb feature to be enabled at compile time (enabled by default).
InMemory
Use an in-memory HashMap for storage. This is useful for testing.
Implementations§
Source§impl BackendConfig
impl BackendConfig
Sourcepub fn build(&self) -> Result<Box<dyn IndexBackend>, IndexError>
pub fn build(&self) -> Result<Box<dyn IndexBackend>, IndexError>
Build the backend based on the configuration.
This method creates the appropriate backend implementation based on the configuration variant. Each backend type is only available if its corresponding feature flag is enabled at compile time.
§Returns
Ok(Box<dyn IndexBackend>)- Successfully created backendErr(IndexError)- Failed to create backend or feature not enabled
Trait Implementations§
Source§impl Clone for BackendConfig
impl Clone for BackendConfig
Source§fn clone(&self) -> BackendConfig
fn clone(&self) -> BackendConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BackendConfig
impl Debug for BackendConfig
Source§impl Default for BackendConfig
impl Default for BackendConfig
Source§fn default() -> BackendConfig
fn default() -> BackendConfig
Auto Trait Implementations§
impl Freeze for BackendConfig
impl RefUnwindSafe for BackendConfig
impl Send for BackendConfig
impl Sync for BackendConfig
impl Unpin for BackendConfig
impl UnwindSafe for BackendConfig
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
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>
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>
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