pub struct EnvFile { /* private fields */ }Expand description
An ordered .env file. Serialized as its text; deserialized from text
or from a {KEY: value | {secret: NAME}} map.
Implementations§
Source§impl EnvFile
impl EnvFile
Sourcepub fn parse(text: &str) -> Result<EnvFile>
pub fn parse(text: &str) -> Result<EnvFile>
Parse .env text. export KEY=v is accepted; a later duplicate
replaces the earlier value in place.
Sourcepub fn set(&mut self, key: &str, value: EnvValue)
pub fn set(&mut self, key: &str, value: EnvValue)
Set a variable: in place if present, else appended.
pub fn remove(&mut self, key: &str) -> bool
pub fn get(&self, key: &str) -> Option<&EnvValue>
pub fn vars(&self) -> impl Iterator<Item = (&str, &EnvValue)>
pub fn to_map(&self) -> BTreeMap<String, EnvValue>
pub fn from_map(m: &BTreeMap<String, EnvValue>) -> Result<EnvFile>
Sourcepub fn secret_names(&self) -> Vec<String>
pub fn secret_names(&self) -> Vec<String>
The names of the store secrets it references.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for EnvFile
impl<'de> Deserialize<'de> for EnvFile
Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl Eq for EnvFile
impl StructuralPartialEq for EnvFile
Auto Trait Implementations§
impl Freeze for EnvFile
impl RefUnwindSafe for EnvFile
impl Send for EnvFile
impl Sync for EnvFile
impl Unpin for EnvFile
impl UnsafeUnpin for EnvFile
impl UnwindSafe for EnvFile
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.