Struct conch_runtime::env::VarRestorer [] [src]

pub struct VarRestorer<E: ?Sized> where
    E: VariableEnvironment
{ /* fields omitted */ }

Maintains 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.

Methods

impl<E: ?Sized> VarRestorer<E> where
    E: VariableEnvironment
[src]

[src]

Create a new wrapper.

[src]

Create a new wrapper and reserve capacity for backing up the previous file descriptors of the environment.

[src]

Deprecated

: use the VarEnvRestorer trait instead

Restore all variable definitions to their original state.

impl<E: ?Sized> VarRestorer<E> where
    E: ExportedVariableEnvironment,
    E::VarName: Clone,
    E::Var: Clone
[src]

[src]

Deprecated

: use the VarEnvRestorer trait instead

Backup and set the value of some variable, maintaining its status as an environment variable if previously set as such.

[src]

Deprecated

: use the VarEnvRestorer trait instead

Backup and unset the value of some variable (including environment variables).

[src]

Deprecated

: use the VarEnvRestorer trait instead

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.

Trait Implementations

impl<E: Clone + ?Sized> Clone for VarRestorer<E> where
    E: VariableEnvironment,
    E::VarName: Clone,
    E::Var: Clone
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<E: ?Sized> Eq for VarRestorer<E> where
    E: VariableEnvironment,
    E::VarName: Eq,
    E::Var: Eq
[src]

impl<E: ?Sized> PartialEq<Self> for VarRestorer<E> where
    E: VariableEnvironment,
    E::VarName: Eq,
    E::Var: Eq
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

1.0.0
[src]

This method tests for !=.

impl<E: ?Sized> Debug for VarRestorer<E> where
    E: VariableEnvironment,
    E::VarName: Debug,
    E::Var: Debug
[src]

[src]

Formats the value using the given formatter.

impl<E: ?Sized> Default for VarRestorer<E> where
    E: VariableEnvironment
[src]

[src]

Returns the "default value" for a type. Read more

impl<E: ?Sized> VarEnvRestorer<E> for VarRestorer<E> where
    E: ExportedVariableEnvironment + UnsetVariableEnvironment,
    E::VarName: Clone,
    E::Var: Clone
[src]

[src]

Reserves capacity for at least additional more variables to be backed up.

[src]

Deprecated

: Use VarEnvRestorer2::set_exported_var2 instead

Backup and set the value of some variable (and its exported status).

[src]

Backup and unset the value of some variable (including environment variables).

[src]

Backs up the original value of specified variable. Read more

[src]

Restore all variable definitions to their original state.

impl<E: ?Sized> VarEnvRestorer2<E> for VarRestorer<E> where
    E: ExportedVariableEnvironment + UnsetVariableEnvironment,
    E::VarName: Clone,
    E::Var: Clone
[src]

[src]

Backup and set the value of some variable, either explicitly setting its exported status as specified, or maintaining its status as an environment variable if previously set as such. Read more