pub struct EnvSync { /* private fields */ }
Implementations§
Source§impl EnvSync
impl EnvSync
Sourcepub fn new() -> Result<Self, String>
pub fn new() -> Result<Self, String>
The newly created ‘EnvSync’ instance loads the ‘.env’ file and manages environmental variables in memory.
Sourcepub fn reload(&mut self) -> Result<(), String>
pub fn reload(&mut self) -> Result<(), String>
Load environment variables from the ‘.env’ file and synchronize them with your system environment.
Sourcepub fn get_system_env(&self, key: &str) -> Option<String>
pub fn get_system_env(&self, key: &str) -> Option<String>
Gets values from system environment variables.
Sourcepub fn get_mem_env(&self, key: &str) -> Option<String>
pub fn get_mem_env(&self, key: &str) -> Option<String>
Gets the value from within memory.
Sourcepub fn set(&mut self, key: &str, value: &str) -> Result<(), String>
pub fn set(&mut self, key: &str, value: &str) -> Result<(), String>
Sets values for both memory and system environment variables.
Sourcepub fn remove(&mut self, key: &str) -> Result<(), String>
pub fn remove(&mut self, key: &str) -> Result<(), String>
Remove values from system environment variables and also from the ‘.env’ file.
Sourcepub fn export_all_to_system(&self) -> Result<(), String>
pub fn export_all_to_system(&self) -> Result<(), String>
Export all in-memory environment variables to system environment variables.
Auto Trait Implementations§
impl Freeze for EnvSync
impl RefUnwindSafe for EnvSync
impl Send for EnvSync
impl Sync for EnvSync
impl Unpin for EnvSync
impl UnwindSafe for EnvSync
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