pub struct MockSender { /* private fields */ }Implementations§
Source§impl MockSender
impl MockSender
This is primarily for internal use.
Unless directed otherwise, it will generally return a reasonable default
response, at least for RpcRequest values for which responses have been
implemented.
The behavior can be customized in two ways:
-
The
urlconstructor argument is not actually a URL, but a simple string directive that changesMockSenders behavior in specific scenarios.If
urlis “fails” then any call tosendwill returnOk(Value::Null).It is customary to set the
urlto “succeeds” for mocks that should return successfully, though this value is not actually interpreted.Other possible values of
urlare specific to differentRpcRequestvalues. Read the implementation for specifics. -
Custom responses can be configured by providing
Mocksto theMockSender::new_with_mocksconstructor. This type is aHashMapfromRpcRequestto a JSONValueresponse, Any entries in this map override the default behavior for the given request.
Trait Implementations§
Source§impl RpcSender for MockSender
impl RpcSender for MockSender
Auto Trait Implementations§
impl !Freeze for MockSender
impl RefUnwindSafe for MockSender
impl Send for MockSender
impl Sync for MockSender
impl Unpin for MockSender
impl UnwindSafe for MockSender
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
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>
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>
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