pub struct EnvConfigValue<'a> { /* private fields */ }
Expand description
Environment config values are config values sourced from a user’s environment variables or profile file.
EnvConfigValue
will first look in the environment, then the AWS profile. They track the
provenance of properties so that unified validation errors can be created.
Implementations§
Source§impl<'a> EnvConfigValue<'a>
impl<'a> EnvConfigValue<'a>
Sourcepub fn service_id(self, service_id: &'a str) -> Self
pub fn service_id(self, service_id: &'a str) -> Self
Set the service id to check for service config
Sourcepub fn validate<T, E: Error + Send + Sync + 'static>(
self,
env: &Env,
profiles: Option<&EnvConfigSections>,
validator: impl Fn(&str) -> Result<T, E>,
) -> Result<Option<T>, EnvConfigError<E>>
pub fn validate<T, E: Error + Send + Sync + 'static>( self, env: &Env, profiles: Option<&EnvConfigSections>, validator: impl Fn(&str) -> Result<T, E>, ) -> Result<Option<T>, EnvConfigError<E>>
Load the value from the env or profile files, validating with validator
Sourcepub fn validate_and_return_origin<T, E: Error + Send + Sync + 'static>(
self,
env: &Env,
profiles: Option<&EnvConfigSections>,
validator: impl Fn(&str) -> Result<T, E>,
) -> Result<(Option<T>, Origin), EnvConfigError<E>>
pub fn validate_and_return_origin<T, E: Error + Send + Sync + 'static>( self, env: &Env, profiles: Option<&EnvConfigSections>, validator: impl Fn(&str) -> Result<T, E>, ) -> Result<(Option<T>, Origin), EnvConfigError<E>>
Load the value from the env or profile files, validating with validator
This version of the function will also return the origin of the config.
Sourcepub fn load(
&self,
env: &'a Env,
profiles: Option<&'a EnvConfigSections>,
) -> Option<(Cow<'a, str>, EnvConfigSource<'a>)>
pub fn load( &self, env: &'a Env, profiles: Option<&'a EnvConfigSections>, ) -> Option<(Cow<'a, str>, EnvConfigSource<'a>)>
Load the value from the environment
Trait Implementations§
Source§impl<'a> Debug for EnvConfigValue<'a>
impl<'a> Debug for EnvConfigValue<'a>
Source§impl<'a> Default for EnvConfigValue<'a>
impl<'a> Default for EnvConfigValue<'a>
Source§fn default() -> EnvConfigValue<'a>
fn default() -> EnvConfigValue<'a>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<'a> Freeze for EnvConfigValue<'a>
impl<'a> RefUnwindSafe for EnvConfigValue<'a>
impl<'a> Send for EnvConfigValue<'a>
impl<'a> Sync for EnvConfigValue<'a>
impl<'a> Unpin for EnvConfigValue<'a>
impl<'a> UnwindSafe for EnvConfigValue<'a>
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> 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>
Creates a shared type from an unshared type.