pub struct EnvConfig { /* private fields */ }Expand description
Layered environment configuration source combining .env files, explicit overrides, and OS env vars.
Implementations§
Source§impl EnvConfig
Layering and typed extraction methods for EnvConfig.
impl EnvConfig
Layering and typed extraction methods for EnvConfig.
Sourcepub fn from_process_env() -> Self
pub fn from_process_env() -> Self
Sourcepub fn from_dotenv_str(content: &str) -> Result<Self, EnvError>
pub fn from_dotenv_str(content: &str) -> Result<Self, EnvError>
Sourcepub fn with_prefix<S>(self, prefix: S) -> Self
pub fn with_prefix<S>(self, prefix: S) -> Self
Sourcepub fn merge_dotenv_file(&mut self, path: &Path) -> Result<&mut Self, EnvError>
pub fn merge_dotenv_file(&mut self, path: &Path) -> Result<&mut Self, EnvError>
Sourcepub fn merge_process_env(&mut self) -> &mut Self
pub fn merge_process_env(&mut self) -> &mut Self
Merges current OS environment variables on top of loaded .env defaults.
§Returns
&mut Self- Mutable reference for chaining.
Sourcepub fn require(&self, key: &str) -> Result<String, EnvError>
pub fn require(&self, key: &str) -> Result<String, EnvError>
Returns a required non-empty string value or EnvError::MissingKey.
§Arguments
&str- Key name.
§Returns
Result<String, EnvError>- Owned value or missing-key error.
Sourcepub fn require_secret(&self, key: &str) -> Result<SecretString, EnvError>
pub fn require_secret(&self, key: &str) -> Result<SecretString, EnvError>
Returns a wrapped SecretString for a required secret key.
§Arguments
&str- Secret key name.
§Returns
Result<SecretString, EnvError>- Secret wrapper or missing-key error.
Trait Implementations§
Auto Trait Implementations§
impl Forget for EnvConfig
impl Freeze for EnvConfig
impl Move for EnvConfig
impl RefUnwindSafe for EnvConfig
impl Send for EnvConfig
impl Sync for EnvConfig
impl Unpin for EnvConfig
impl UnsafeUnpin for EnvConfigwhere
*const LeafNode<String, String> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, String)>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
impl UnwindSafe for EnvConfig
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