pub struct Mock { /* private fields */ }
Expand description
Mock environment.
Only available when running tests, implements the IsEnvironment
trait to allow testing Provider
implementations. Holds an
internal queue of “replies” to return, using the Mock::push_raw()
and Mock::pop_raw()
functions. Replies are returned from pop_raw()
in the exact order they were
pushed in.
Implementations§
Source§impl Mock
impl Mock
pub fn new() -> Self
Sourcepub fn push_raw(&self, entry: Result<String, ExecutionError>)
pub fn push_raw(&self, entry: Result<String, ExecutionError>)
Push a raw result into the result queue.
Sourcepub fn pop_raw(&self) -> Result<String, ExecutionError>
pub fn pop_raw(&self) -> Result<String, ExecutionError>
Pop a raw result from the result queue.
Sourcepub fn to_env(self) -> Arc<Environment>
pub fn to_env(self) -> Arc<Environment>
Convert into an Arc<Environment>
.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Mock
impl<'de> Deserialize<'de> for Mock
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl IsEnvironment for Mock
impl IsEnvironment for Mock
Source§impl Ord for Mock
impl Ord for Mock
Source§impl PartialOrd for Mock
impl PartialOrd for Mock
impl Eq for Mock
Auto Trait Implementations§
impl !Freeze for Mock
impl RefUnwindSafe for Mock
impl Send for Mock
impl Sync for Mock
impl Unpin for Mock
impl UnwindSafe for Mock
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> 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