pub struct ConfigBuilder { /* private fields */ }Expand description
Builder for creating customized Config instances.
This builder provides a fluent API for constructing configuration objects with non-default values.
§Examples
use txgate_core::config::{Config, ConfigBuilder};
let config = ConfigBuilder::new()
.socket_path("/custom/path.sock")
.timeout_secs(120)
.keys_directory("/custom/keys")
.default_key("production")
.build();
assert_eq!(config.server.socket_path, "/custom/path.sock");
assert_eq!(config.server.timeout_secs, 120);
assert_eq!(config.keys.directory, "/custom/keys");
assert_eq!(config.keys.default_key, "production");Implementations§
Source§impl ConfigBuilder
impl ConfigBuilder
Sourcepub fn socket_path(self, path: impl Into<String>) -> Self
pub fn socket_path(self, path: impl Into<String>) -> Self
Sourcepub const fn timeout_secs(self, secs: u64) -> Self
pub const fn timeout_secs(self, secs: u64) -> Self
Sourcepub fn keys_directory(self, dir: impl Into<String>) -> Self
pub fn keys_directory(self, dir: impl Into<String>) -> Self
Sourcepub fn default_key(self, name: impl Into<String>) -> Self
pub fn default_key(self, name: impl Into<String>) -> Self
Sourcepub fn policy(self, policy: PolicyConfig) -> Self
pub fn policy(self, policy: PolicyConfig) -> Self
Trait Implementations§
Source§impl Clone for ConfigBuilder
impl Clone for ConfigBuilder
Source§fn clone(&self) -> ConfigBuilder
fn clone(&self) -> ConfigBuilder
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 ConfigBuilder
impl Debug for ConfigBuilder
Source§impl Default for ConfigBuilder
impl Default for ConfigBuilder
Source§fn default() -> ConfigBuilder
fn default() -> ConfigBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ConfigBuilder
impl RefUnwindSafe for ConfigBuilder
impl Send for ConfigBuilder
impl Sync for ConfigBuilder
impl Unpin for ConfigBuilder
impl UnwindSafe for ConfigBuilder
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