pub struct SettingsEnv { /* private fields */ }Expand description
An EnvSource with the settings/profile
fallback — the value form of get_env_var.
Reads the real process environment first, then the active profile’s env
(or the base env when no profile is active) in
$HOME/.omni-dev/settings.json.
Pass &SettingsEnv::load() from a thin production wrapper; tests inject a
pure MapEnv into the same *_with(&impl EnvSource, …) seam instead of
mutating the process environment.
Implementations§
Source§impl SettingsEnv
impl SettingsEnv
Sourcepub fn load() -> Self
pub fn load() -> Self
Loads settings from the default location, falling back to an empty
settings map if they are absent or unreadable (env-only behaviour). The
active profile is read from OMNI_DEV_PROFILE.
Sourcepub fn load_with_profile(profile: Option<&str>) -> Self
pub fn load_with_profile(profile: Option<&str>) -> Self
Like load but with the active profile supplied
explicitly — for tests and embedders that select a profile without
setting OMNI_DEV_PROFILE in the process environment.
Sourcepub fn from_settings(settings: Settings, profile: Option<&str>) -> Self
pub fn from_settings(settings: Settings, profile: Option<&str>) -> Self
Wraps an already-loaded Settings, skipping the disk read/parse
load/load_with_profile
perform — for callers (e.g. load_credentials_for/status_for in
crate::gmail::auth/crate::drive::auth) that already loaded
Settings to resolve an account and would otherwise discard it just
to re-read the same file a second time (issue #1533).
Trait Implementations§
Source§impl Debug for SettingsEnv
impl Debug for SettingsEnv
Source§impl Default for SettingsEnv
impl Default for SettingsEnv
Source§fn default() -> SettingsEnv
fn default() -> SettingsEnv
Auto Trait Implementations§
impl Freeze for SettingsEnv
impl RefUnwindSafe for SettingsEnv
impl Send for SettingsEnv
impl Sync for SettingsEnv
impl Unpin for SettingsEnv
impl UnsafeUnpin for SettingsEnv
impl UnwindSafe for SettingsEnv
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
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> ⓘ
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> ⓘ
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