pub struct ClawConfigBuilder { /* private fields */ }Expand description
Builder for ClawConfig.
Obtain an instance via ClawConfig::builder(). Every setter is chainable
and the final ClawConfigBuilder::build() call validates the collected
values before returning a ClawConfig.
Implementations§
Source§impl ClawConfigBuilder
impl ClawConfigBuilder
Sourcepub fn db_path(self, path: impl Into<PathBuf>) -> Self
pub fn db_path(self, path: impl Into<PathBuf>) -> Self
Set the path to the SQLite database file.
Sourcepub fn max_connections(self, n: u32) -> Self
pub fn max_connections(self, n: u32) -> Self
Set the maximum number of connections in the connection pool.
Sourcepub fn wal_enabled(self, enabled: bool) -> Self
pub fn wal_enabled(self, enabled: bool) -> Self
Enable or disable WAL mode.
Sourcepub fn cache_size_mb(self, mb: usize) -> Self
pub fn cache_size_mb(self, mb: usize) -> Self
Set the maximum in-memory cache size in mebibytes.
Sourcepub fn auto_migrate(self, enabled: bool) -> Self
pub fn auto_migrate(self, enabled: bool) -> Self
Enable or disable automatic migration on engine startup.
Sourcepub fn snapshot_dir(self, dir: impl Into<PathBuf>) -> Self
pub fn snapshot_dir(self, dir: impl Into<PathBuf>) -> Self
Set the directory used to store snapshots.
Sourcepub fn journal_mode(self, mode: JournalMode) -> Self
pub fn journal_mode(self, mode: JournalMode) -> Self
Set the SQLite journal mode.
Sourcepub fn workspace_id(self, workspace_id: impl Into<String>) -> Self
pub fn workspace_id(self, workspace_id: impl Into<String>) -> Self
Set the logical workspace identifier for tracing instrumentation.
Sourcepub fn build(self) -> ClawResult<ClawConfig>
pub fn build(self) -> ClawResult<ClawConfig>
Validate the collected values and return a ClawConfig.
§Errors
Returns ClawError::Config if:
db_pathis not set, or its parent directory does not exist and cannot be created.max_connectionsis0.cache_size_mbis0.
Trait Implementations§
Source§impl Clone for ClawConfigBuilder
impl Clone for ClawConfigBuilder
Source§fn clone(&self) -> ClawConfigBuilder
fn clone(&self) -> ClawConfigBuilder
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 ClawConfigBuilder
impl Debug for ClawConfigBuilder
Source§impl Default for ClawConfigBuilder
impl Default for ClawConfigBuilder
Source§impl<'de> Deserialize<'de> for ClawConfigBuilder
impl<'de> Deserialize<'de> for ClawConfigBuilder
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ClawConfigBuilder
impl RefUnwindSafe for ClawConfigBuilder
impl Send for ClawConfigBuilder
impl Sync for ClawConfigBuilder
impl Unpin for ClawConfigBuilder
impl UnsafeUnpin for ClawConfigBuilder
impl UnwindSafe for ClawConfigBuilder
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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