Struct ethers_providers::MockProvider
source · pub struct MockProvider { /* private fields */ }
Expand description
Mock transport used in test environments.
Implementations§
source§impl MockProvider
impl MockProvider
sourcepub fn assert_request<T: Serialize + Send + Sync>(
&self,
method: &str,
data: T
) -> Result<(), MockError>
pub fn assert_request<T: Serialize + Send + Sync>( &self, method: &str, data: T ) -> Result<(), MockError>
Checks that the provided request was submitted by the client
sourcepub fn push<T: Serialize + Send + Sync, K: Borrow<T>>(
&self,
data: K
) -> Result<(), MockError>
pub fn push<T: Serialize + Send + Sync, K: Borrow<T>>( &self, data: K ) -> Result<(), MockError>
Pushes the data to the responses
sourcepub fn push_response(&self, response: MockResponse)
pub fn push_response(&self, response: MockResponse)
Pushes the data or error to the responses
Trait Implementations§
source§impl Clone for MockProvider
impl Clone for MockProvider
source§fn clone(&self) -> MockProvider
fn clone(&self) -> MockProvider
Returns a copy of the value. Read more
1.0.0 · 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 MockProvider
impl Debug for MockProvider
source§impl Default for MockProvider
impl Default for MockProvider
source§impl JsonRpcClient for MockProvider
impl JsonRpcClient for MockProvider
source§fn request<'life0, 'life1, 'async_trait, T, R>(
&'life0 self,
method: &'life1 str,
params: T
) -> Pin<Box<dyn Future<Output = Result<R, MockError>> + Send + 'async_trait>>where
T: 'async_trait + Serialize + Send + Sync,
R: 'async_trait + DeserializeOwned,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn request<'life0, 'life1, 'async_trait, T, R>(
&'life0 self,
method: &'life1 str,
params: T
) -> Pin<Box<dyn Future<Output = Result<R, MockError>> + Send + 'async_trait>>where
T: 'async_trait + Serialize + Send + Sync,
R: 'async_trait + DeserializeOwned,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Pushes the (method, params)
to the back of the requests
queue,
pops the responses from the back of the responses
queue
Auto Trait Implementations§
impl RefUnwindSafe for MockProvider
impl Send for MockProvider
impl Sync for MockProvider
impl Unpin for MockProvider
impl UnwindSafe for MockProvider
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