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 PartialEq<Mock> for Mock
impl PartialEq<Mock> for Mock
source§impl PartialOrd<Mock> for Mock
impl PartialOrd<Mock> for Mock
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl Eq for Mock
Auto Trait Implementations§
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