Trait conch_runtime::env::VarEnvRestorer
[−]
[src]
pub trait VarEnvRestorer<E: ?Sized + VariableEnvironment> { fn reserve(&mut self, additional: usize); fn set_exported_var(
&mut self,
name: E::VarName,
val: E::Var,
exported: bool,
env: &mut E
); fn unset_var(&mut self, name: E::VarName, env: &mut E); fn backup(&mut self, key: E::VarName, env: &E); fn restore(&mut self, env: &mut E); }
An interface for maintaining a state of all variable definitions that have been modified so that they can be restored later.
Note: the caller should take care that a restorer instance is always called with the same environment for its entire lifetime. Using different environments with the same restorer instance will undoubtedly do the wrong thing eventually, and no guarantees can be made.
Required Methods
fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional
more variables to be backed up.
fn set_exported_var(
&mut self,
name: E::VarName,
val: E::Var,
exported: bool,
env: &mut E
)
&mut self,
name: E::VarName,
val: E::Var,
exported: bool,
env: &mut E
)
: Use VarEnvRestorer2::set_exported_var2
instead
Backup and set the value of some variable (and its exported status).
fn unset_var(&mut self, name: E::VarName, env: &mut E)
Backup and unset the value of some variable (including environment variables).
fn backup(&mut self, key: E::VarName, env: &E)
Backs up the original value of specified variable.
The original value of the variable is the one the environment held before it was passed into this wrapper. That is, if a variable is backed up multiple times, only the value before the first call could be restored later.
fn restore(&mut self, env: &mut E)
Restore all variable definitions to their original state.
Implementations on Foreign Types
impl<'a, T, E: ?Sized> VarEnvRestorer<E> for &'a mut T where
T: VarEnvRestorer<E>,
E: VariableEnvironment,
[src]
T: VarEnvRestorer<E>,
E: VariableEnvironment,
fn reserve(&mut self, additional: usize)
[src]
fn set_exported_var(
&mut self,
name: E::VarName,
val: E::Var,
exported: bool,
env: &mut E
)
[src]
&mut self,
name: E::VarName,
val: E::Var,
exported: bool,
env: &mut E
)
: Use VarEnvRestorer2::set_exported_var2
instead
fn unset_var(&mut self, name: E::VarName, env: &mut E)
[src]
fn backup(&mut self, key: E::VarName, env: &E)
[src]
fn restore(&mut self, env: &mut E)
[src]
Implementors
impl<E: ?Sized> VarEnvRestorer<E> for VarRestorer<E> where
E: ExportedVariableEnvironment + UnsetVariableEnvironment,
E::VarName: Clone,
E::Var: Clone,