pub struct Envie {
pub variables: HashMap<String, String>,
}Fields§
§variables: HashMap<String, String>Implementations§
Source§impl Envie
impl Envie
Sourcepub fn load() -> Result<Self, String>
pub fn load() -> Result<Self, String>
Load .env file from the current directory and parse it into a new Envie instance.
Sourcepub fn load_with_path(path: &str) -> Result<Self, String>
pub fn load_with_path(path: &str) -> Result<Self, String>
Load a .env file from a specified path and parse it into a new Envie instance.
Sourcepub fn reload(&mut self) -> Result<(), String>
pub fn reload(&mut self) -> Result<(), String>
Reload the .env file from the current directory.
Sourcepub fn contains_key(&self, key: &str) -> bool
pub fn contains_key(&self, key: &str) -> bool
Check if a key exists in the environment variables.
Sourcepub fn set(&mut self, key: &str, value: &str) -> Result<(), String>
pub fn set(&mut self, key: &str, value: &str) -> Result<(), String>
Set a value for a given key and update the .env file.
Sourcepub fn remove(&mut self, key: &str) -> Result<(), String>
pub fn remove(&mut self, key: &str) -> Result<(), String>
Remove a key-value pair and update the .env file.
Sourcepub unsafe fn set_system_env(
&mut self,
key: &str,
value: &str,
) -> Result<(), String>
pub unsafe fn set_system_env( &mut self, key: &str, value: &str, ) -> Result<(), String>
Set and apply the variable to the system environment
Sourcepub unsafe fn export_to_system_env(&self) -> Result<(), String>
pub unsafe fn export_to_system_env(&self) -> Result<(), String>
Export all loaded variables to the system environment.
Auto Trait Implementations§
impl Freeze for Envie
impl RefUnwindSafe for Envie
impl Send for Envie
impl Sync for Envie
impl Unpin for Envie
impl UnwindSafe for Envie
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