pub struct ConnectorConfigLoader { /* private fields */ }Expand description
Helper for loading connector configuration from TOML files and environment variables.
This loader provides a flexible way to load configuration values from various sources.
Implementations§
Source§impl ConnectorConfigLoader
impl ConnectorConfigLoader
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a loader that reads the configuration path from CONNECTOR_CONFIG_PATH.
Sourcepub fn with_path_env(self, env_var: impl Into<String>) -> Self
pub fn with_path_env(self, env_var: impl Into<String>) -> Self
Override the environment variable used to locate the configuration file.
Sourcepub fn load<T>(&self) -> ConnectorResult<T>
pub fn load<T>(&self) -> ConnectorResult<T>
Load a configuration value from the configured path environment variable.
Sourcepub fn from_file<T>(&self, path: impl AsRef<Path>) -> ConnectorResult<T>
pub fn from_file<T>(&self, path: impl AsRef<Path>) -> ConnectorResult<T>
Load a configuration value from a TOML file path.
Sourcepub fn parse_str<T>(
&self,
content: &str,
source_name: &str,
) -> ConnectorResult<T>
pub fn parse_str<T>( &self, content: &str, source_name: &str, ) -> ConnectorResult<T>
Parse a configuration value directly from TOML content.
Trait Implementations§
Source§impl Clone for ConnectorConfigLoader
impl Clone for ConnectorConfigLoader
Source§fn clone(&self) -> ConnectorConfigLoader
fn clone(&self) -> ConnectorConfigLoader
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 ConnectorConfigLoader
impl Debug for ConnectorConfigLoader
Auto Trait Implementations§
impl Freeze for ConnectorConfigLoader
impl RefUnwindSafe for ConnectorConfigLoader
impl Send for ConnectorConfigLoader
impl Sync for ConnectorConfigLoader
impl Unpin for ConnectorConfigLoader
impl UnsafeUnpin for ConnectorConfigLoader
impl UnwindSafe for ConnectorConfigLoader
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request