Struct solana_client::mock_sender::MockSender[][src]

pub struct MockSender { /* fields omitted */ }

Implementations

An RpcSender used for unit testing RpcClient.

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:

  1. The url constructor argument is not actually a URL, but a simple string directive that changes MockSenders behavior in specific scenarios.

    If url is “fails” then any call to send will return Ok(Value::Null).

    It is customary to set the url to “succeeds” for mocks that should return sucessfully, though this value is not actually interpreted.

    Other possible values of url are specific to different RpcRequest values. Read the implementation for specifics.

  2. Custom responses can be configured by providing Mocks to the MockSender::new_with_mocks constructor. This type is a HashMap from RpcRequest to a JSON Value response, Any entries in this map override the default behavior for the given request.

Trait Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more