pub struct GraphConfig {
pub backend: BackendKind,
pub sqlite: SqliteConfig,
pub native: NativeConfig,
}Expand description
Complete configuration for graph construction.
This structure combines backend selection with backend-specific configuration options. Default values provide optimal behavior for most use cases.
§Default Configuration
use sqlitegraph::{GraphConfig, BackendKind};
let config = GraphConfig::default();
assert_eq!(config.backend, BackendKind::SQLite);
assert!(!config.sqlite.without_migrations);
assert!(config.native.create_if_missing);§Examples
use sqlitegraph::{GraphConfig, BackendKind};
use std::collections::HashMap;
// Simple SQLite configuration
let sqlite_cfg = GraphConfig::sqlite();
// Simple Native configuration
let native_cfg = GraphConfig::native();
// Custom SQLite configuration with PRAGMAs
let mut custom_sqlite = GraphConfig::sqlite();
custom_sqlite.sqlite.pragma_settings.insert("journal_mode".to_string(), "WAL".to_string());
custom_sqlite.sqlite.pragma_settings.insert("synchronous".to_string(), "NORMAL".to_string());
// Custom Native configuration with capacity pre-allocation
let mut custom_native = GraphConfig::native();
custom_native.native.reserve_node_capacity = Some(10000);
custom_native.native.reserve_edge_capacity = Some(50000);Fields§
§backend: BackendKindWhich backend to use for graph storage
Default: BackendKind::SQLite
This field determines the storage implementation used for the graph.
Both backends implement the same GraphBackend trait, ensuring
identical API behavior regardless of the selected backend.
sqlite: SqliteConfigSQLite-specific configuration options
Default: SqliteConfig::default()
These options are only used when backend is BackendKind::SQLite.
When using the Native backend, these settings are ignored but still
available for configuration consistency when switching backends.
native: NativeConfigNative-specific configuration options
Default: NativeConfig::default()
These options are only used when backend is BackendKind::Native.
When using the SQLite backend, these settings are ignored but still
available for configuration consistency when switching backends.
Implementations§
Source§impl GraphConfig
impl GraphConfig
Sourcepub fn new(backend: BackendKind) -> Self
pub fn new(backend: BackendKind) -> Self
Create a new configuration with the specified backend.
Sourcepub fn with_cpu_profile(self, profile: CpuProfile) -> Self
pub fn with_cpu_profile(self, profile: CpuProfile) -> Self
Set the CPU profile for the Native backend (builder pattern)
This method only affects the Native configuration and has no effect when using the SQLite backend.
§Arguments
profile- The CPU profile to use for native optimizations
§Returns
Self for method chaining
§Examples
use sqlitegraph::{GraphConfig, backend::native::CpuProfile};
let cfg = GraphConfig::native()
.with_cpu_profile(CpuProfile::X86Zen4);Trait Implementations§
Source§impl Clone for GraphConfig
impl Clone for GraphConfig
Source§fn clone(&self) -> GraphConfig
fn clone(&self) -> GraphConfig
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GraphConfig
impl Debug for GraphConfig
Auto Trait Implementations§
impl Freeze for GraphConfig
impl RefUnwindSafe for GraphConfig
impl Send for GraphConfig
impl Sync for GraphConfig
impl Unpin for GraphConfig
impl UnwindSafe for GraphConfig
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)