pub struct MockEnvProvider { /* private fields */ }Expand description
Mock environment provider for testing.
Tracks which keys were accessed, so tests can assert on that with
assert_accessed / assert_not_accessed.
Implementations§
Source§impl MockEnvProvider
impl MockEnvProvider
pub fn new() -> Self
pub fn with_vars(vars: HashMap<String, String>) -> Self
pub fn set(&mut self, key: impl Into<String>, value: impl Into<String>)
pub fn remove(&mut self, key: &str)
pub fn all(&self) -> &HashMap<String, String>
pub fn accessed_keys(&self) -> Vec<String>
pub fn was_accessed(&self, key: &str) -> bool
pub fn clear_accessed(&self)
pub fn assert_accessed(&self, key: &str)
pub fn assert_not_accessed(&self, key: &str)
Trait Implementations§
Source§impl Clone for MockEnvProvider
impl Clone for MockEnvProvider
Source§fn clone(&self) -> MockEnvProvider
fn clone(&self) -> MockEnvProvider
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MockEnvProvider
impl Debug for MockEnvProvider
Source§impl Default for MockEnvProvider
impl Default for MockEnvProvider
Source§fn default() -> MockEnvProvider
fn default() -> MockEnvProvider
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MockEnvProvider
impl RefUnwindSafe for MockEnvProvider
impl Send for MockEnvProvider
impl Sync for MockEnvProvider
impl Unpin for MockEnvProvider
impl UnsafeUnpin for MockEnvProvider
impl UnwindSafe for MockEnvProvider
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more