pub struct StorageConfig {
pub db_path: Option<PathBuf>,
}Expand description
Configuration for storage backends.
This struct allows components to configure storage without needing to know implementation details like SQLite. Users provide what they want (path, options), not how it’s implemented.
§Example
use mi6_core::StorageConfig;
// Use defaults (reads from MI6_DIR_PATH or ~/.mi6)
let config = StorageConfig::default();
// Custom database path
let config = StorageConfig {
db_path: Some("/tmp/test.db".into()),
..Default::default()
};Fields§
§db_path: Option<PathBuf>Database path. If None, uses the default location.
Resolution order (when calling resolve_db_path()):
- This field if set
- Default:
<mi6_dir>/mi6.db
Implementations§
Source§impl StorageConfig
impl StorageConfig
Sourcepub fn with_path(path: impl Into<PathBuf>) -> Self
pub fn with_path(path: impl Into<PathBuf>) -> Self
Create a storage config with a specific database path.
Sourcepub fn resolve_db_path(&self) -> Result<PathBuf, ConfigError>
pub fn resolve_db_path(&self) -> Result<PathBuf, ConfigError>
Get the effective database path, resolving defaults if needed.
Resolution order:
db_pathfield if set- Default:
<mi6_dir>/mi6.db
Trait Implementations§
Source§impl Clone for StorageConfig
impl Clone for StorageConfig
Source§fn clone(&self) -> StorageConfig
fn clone(&self) -> StorageConfig
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 moreSource§impl Debug for StorageConfig
impl Debug for StorageConfig
Source§impl Default for StorageConfig
impl Default for StorageConfig
Source§fn default() -> StorageConfig
fn default() -> StorageConfig
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for StorageConfig
impl RefUnwindSafe for StorageConfig
impl Send for StorageConfig
impl Sync for StorageConfig
impl Unpin for StorageConfig
impl UnwindSafe for StorageConfig
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