pub(super) struct Var<'env, 'lookup, T> {
lookup: &'lookup (dyn Fn(&str) -> Option<String> + 'env),
key: EnvKey,
checks: Vec<fn(EnvKey, T) -> Result<T>>,
aliases: Vec<EnvKey>,
}Fields§
§lookup: &'lookup (dyn Fn(&str) -> Option<String> + 'env)§key: EnvKey§checks: Vec<fn(EnvKey, T) -> Result<T>>§aliases: Vec<EnvKey>Implementations§
Source§impl<T> Var<'_, '_, T>where
T: EnvParse,
impl<T> Var<'_, '_, T>where
T: EnvParse,
pub(super) fn check(self, check: fn(EnvKey, T) -> Result<T>) -> Self
pub(super) fn alias(self, alias: &'static str) -> Self
pub(super) fn required(self) -> Result<T>
pub(super) fn default(self, default: T) -> Result<T>
pub(super) fn optional(self) -> Result<Option<T>>
fn load(&self) -> Option<EnvValue>
fn load_key(&self, key: EnvKey) -> Option<EnvValue>
fn parse(&self, value: EnvValue) -> Result<T>
fn validate(&self, key: EnvKey, value: T) -> Result<T>
Auto Trait Implementations§
impl<'env, 'lookup, T> Freeze for Var<'env, 'lookup, T>
impl<'env, 'lookup, T> !RefUnwindSafe for Var<'env, 'lookup, T>
impl<'env, 'lookup, T> !Send for Var<'env, 'lookup, T>
impl<'env, 'lookup, T> !Sync for Var<'env, 'lookup, T>
impl<'env, 'lookup, T> Unpin for Var<'env, 'lookup, T>
impl<'env, 'lookup, T> UnsafeUnpin for Var<'env, 'lookup, T>
impl<'env, 'lookup, T> !UnwindSafe for Var<'env, 'lookup, T>
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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