[−][src]Struct test_common::system::env::TemporalEnvironmentVariable
Context manager like struct to create an environment variable to perform test with it.
If environment variable already existed then former value is stored before setting the new one. Former value is restored when this type falls out of scope.
Example
use test_common::system::env::TemporalEnvironmentVariable; { let test_env = TemporalEnvironmentVariable::new("ENVTEST", "test_value"); // Do your operations with environment variable. } // Here test environment variable is set to former value if any..
Fields
name: String
current_value: String
Methods
impl TemporalEnvironmentVariable
[src]
pub fn new<T, U>(name: T, value: U) -> Self where
T: AsRef<str> + AsRef<OsStr>,
U: AsRef<str>,
[src]
T: AsRef<str> + AsRef<OsStr>,
U: AsRef<str>,
Create a TemporalEnvironmentVariable instance with given name and value.
If an env var with the same name already exists, previous value is stored at old_value attribute. That old_value is restored as env var value when this instance is dropped.
pub fn set_var<T>(&mut self, new_value: T) where
T: AsRef<str>,
[src]
T: AsRef<str>,
Trait Implementations
impl Drop for TemporalEnvironmentVariable
[src]
Auto Trait Implementations
impl RefUnwindSafe for TemporalEnvironmentVariable
impl Send for TemporalEnvironmentVariable
impl Sync for TemporalEnvironmentVariable
impl Unpin for TemporalEnvironmentVariable
impl UnwindSafe for TemporalEnvironmentVariable
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,