GraphConfig

Struct GraphConfig 

Source
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: BackendKind

Which 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: SqliteConfig

SQLite-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: NativeConfig

Native-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

Source

pub fn new(backend: BackendKind) -> Self

Create a new configuration with the specified backend.

Source

pub fn sqlite() -> Self

Create a configuration for SQLite backend.

Source

pub fn native() -> Self

Create a configuration for Native backend.

Source

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

Source§

fn clone(&self) -> GraphConfig

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GraphConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for GraphConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V