Struct aws_runtime::env_config::EnvConfigValue
source · 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>
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 moreCreates a shared type from an unshared type.