Trait dash_sdk::mock::Mockable

pub trait Mockable: Sized {
    // Provided methods
    fn mock_serialize(&self) -> Option<Vec<u8>> { ... }
    fn mock_deserialize(_data: &[u8]) -> Option<Self> { ... }
}
Expand description

Mocking support for messages.

This trait should be implemented by any object that can be used in the DAPI.

We use serde_json to serialize/deserialize messages.

Provided Methods§

fn mock_serialize(&self) -> Option<Vec<u8>>

Serialize the message to bytes for mocking purposes.

Returns None if the message is not serializable or mocking is disabled.

§Panics

Panics on any error.

fn mock_deserialize(_data: &[u8]) -> Option<Self>

Deserialize the message serialized with [mock_serialize()].

Returns None if the message is not serializable or mocking is disabled.

§Panics

Panics on any error.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

§

impl Mockable for Vec<u8>

§

fn mock_serialize(&self) -> Option<Vec<u8>>

§

fn mock_deserialize(data: &[u8]) -> Option<Vec<u8>>

§

impl Mockable for Status

§

impl<T> Mockable for Option<T>
where T: Mockable,

§

fn mock_serialize(&self) -> Option<Vec<u8>>

§

fn mock_deserialize(data: &[u8]) -> Option<Option<T>>

§

impl<T> Mockable for Streaming<T>
where T: Mockable,

Mocking of gRPC streaming responses is not supported.

This will return None on serialization, effectively disabling mocking of streaming responses.

§

impl<T> Mockable for DumpData<T>
where T: TransportRequest + Mockable, <T as TransportRequest>::Response: Mockable,

§

fn mock_serialize(&self) -> Option<Vec<u8>>

§

fn mock_deserialize(buf: &[u8]) -> Option<DumpData<T>>

§

impl<T, E> Mockable for Result<T, E>
where T: Mockable, E: Mockable,

§

fn mock_serialize(&self) -> Option<Vec<u8>>

§

fn mock_deserialize(data: &[u8]) -> Option<Result<T, E>>

§

impl<TE> Mockable for DapiClientError<TE>
where TE: Mockable,

Serialization of [DapiClientError].

We need to do manual serialization because of the generic type parameter which doesn’t support serde derive.

§

fn mock_serialize(&self) -> Option<Vec<u8>>

§

fn mock_deserialize(data: &[u8]) -> Option<DapiClientError<TE>>

Implementors§

source§

impl Mockable for dash_sdk::platform::types::identity::IdentityRequest

source§

impl Mockable for IdentityResponse

§

impl Mockable for GetConsensusParamsRequestV0

§

impl Mockable for ConsensusParamsBlock

§

impl Mockable for ConsensusParamsEvidence

§

impl Mockable for GetConsensusParamsResponseV0

§

impl Mockable for StartAtVotePollIdInfo

§

impl Mockable for GetContestedResourceIdentityVotesRequestV0

§

impl Mockable for ContestedResourceIdentityVote

§

impl Mockable for ContestedResourceIdentityVotes

§

impl Mockable for ResourceVoteChoice

§

impl Mockable for GetContestedResourceIdentityVotesResponseV0

§

impl Mockable for dash_sdk::platform::proto::get_contested_resource_vote_state_request::get_contested_resource_vote_state_request_v0::StartAtIdentifierInfo

§

impl Mockable for GetContestedResourceVoteStateRequestV0

§

impl Mockable for Contender

§

impl Mockable for ContestedResourceContenders

§

impl Mockable for FinishedVoteInfo

§

impl Mockable for GetContestedResourceVoteStateResponseV0

§

impl Mockable for dash_sdk::platform::proto::get_contested_resource_voters_for_identity_request::get_contested_resource_voters_for_identity_request_v0::StartAtIdentifierInfo

§

impl Mockable for GetContestedResourceVotersForIdentityRequestV0

§

impl Mockable for ContestedResourceVoters

§

impl Mockable for GetContestedResourceVotersForIdentityResponseV0

§

impl Mockable for StartAtValueInfo

§

impl Mockable for GetContestedResourcesRequestV0

§

impl Mockable for ContestedResourceValues

§

impl Mockable for GetContestedResourcesResponseV0

§

impl Mockable for GetDataContractHistoryRequestV0

§

impl Mockable for DataContractHistory

§

impl Mockable for DataContractHistoryEntry

§

impl Mockable for GetDataContractHistoryResponseV0

§

impl Mockable for GetDataContractRequestV0

§

impl Mockable for GetDataContractResponseV0

§

impl Mockable for GetDataContractsRequestV0

§

impl Mockable for DataContractEntry

§

impl Mockable for DataContracts

§

impl Mockable for GetDataContractsResponseV0

§

impl Mockable for GetDocumentsRequestV0

§

impl Mockable for Documents

§

impl Mockable for GetDocumentsResponseV0

§

impl Mockable for GetEpochsInfoRequestV0

§

impl Mockable for EpochInfo

§

impl Mockable for EpochInfos

§

impl Mockable for GetEpochsInfoResponseV0

§

impl Mockable for GetIdentitiesContractKeysRequestV0

§

impl Mockable for IdentitiesKeys

§

impl Mockable for IdentityKeys

§

impl Mockable for PurposeKeys

§

impl Mockable for GetIdentitiesContractKeysResponseV0

§

impl Mockable for GetIdentityBalanceAndRevisionRequestV0

§

impl Mockable for BalanceAndRevision

§

impl Mockable for GetIdentityBalanceAndRevisionResponseV0

§

impl Mockable for GetIdentityBalanceRequestV0

§

impl Mockable for GetIdentityBalanceResponseV0

§

impl Mockable for GetIdentityByPublicKeyHashRequestV0

§

impl Mockable for GetIdentityByPublicKeyHashResponseV0

§

impl Mockable for GetIdentityContractNonceRequestV0

§

impl Mockable for GetIdentityContractNonceResponseV0

§

impl Mockable for GetIdentityKeysRequestV0

§

impl Mockable for Keys

§

impl Mockable for GetIdentityKeysResponseV0

§

impl Mockable for GetIdentityNonceRequestV0

§

impl Mockable for GetIdentityNonceResponseV0

§

impl Mockable for GetIdentityRequestV0

§

impl Mockable for GetIdentityResponseV0

§

impl Mockable for GetPathElementsRequestV0

§

impl Mockable for Elements

§

impl Mockable for GetPathElementsResponseV0

§

impl Mockable for GetPrefundedSpecializedBalanceRequestV0

§

impl Mockable for GetPrefundedSpecializedBalanceResponseV0

§

impl Mockable for ContractRequest

§

impl Mockable for DocumentRequest

§

impl Mockable for dash_sdk::platform::proto::get_proofs_request::get_proofs_request_v0::IdentityRequest

§

impl Mockable for VoteStatusRequest

§

impl Mockable for ContestedResourceVoteStatusRequest

§

impl Mockable for GetProofsRequestV0

§

impl Mockable for GetProofsResponseV0

§

impl Mockable for GetProtocolVersionUpgradeStateRequestV0

§

impl Mockable for VersionEntry

§

impl Mockable for Versions

§

impl Mockable for GetProtocolVersionUpgradeStateResponseV0

§

impl Mockable for GetProtocolVersionUpgradeVoteStatusRequestV0

§

impl Mockable for VersionSignal

§

impl Mockable for VersionSignals

§

impl Mockable for GetProtocolVersionUpgradeVoteStatusResponseV0

§

impl Mockable for GetStatusRequestV0

§

impl Mockable for dash_sdk::platform::proto::get_status_response::get_status_response_v0::Chain

§

impl Mockable for dash_sdk::platform::proto::get_status_response::get_status_response_v0::Network

§

impl Mockable for Node

§

impl Mockable for StateSync

§

impl Mockable for dash_sdk::platform::proto::get_status_response::get_status_response_v0::Time

§

impl Mockable for dash_sdk::platform::proto::get_status_response::get_status_response_v0::Version

§

impl Mockable for Drive

§

impl Mockable for Tenderdash

§

impl Mockable for Protocol

§

impl Mockable for Software

§

impl Mockable for GetStatusResponseV0

§

impl Mockable for GetTotalCreditsInPlatformRequestV0

§

impl Mockable for GetTotalCreditsInPlatformResponseV0

§

impl Mockable for EndAtTimeInfo

§

impl Mockable for StartAtTimeInfo

§

impl Mockable for GetVotePollsByEndDateRequestV0

§

impl Mockable for SerializedVotePollsByTimestamp

§

impl Mockable for SerializedVotePollsByTimestamps

§

impl Mockable for GetVotePollsByEndDateResponseV0

§

impl Mockable for AllKeys

§

impl Mockable for BroadcastStateTransitionRequest

§

impl Mockable for BroadcastStateTransitionResponse

§

impl Mockable for GetConsensusParamsRequest

§

impl Mockable for GetConsensusParamsResponse

§

impl Mockable for GetContestedResourceIdentityVotesRequest

§

impl Mockable for GetContestedResourceIdentityVotesResponse

§

impl Mockable for GetContestedResourceVoteStateRequest

§

impl Mockable for GetContestedResourceVoteStateResponse

§

impl Mockable for GetContestedResourceVotersForIdentityRequest

§

impl Mockable for GetContestedResourceVotersForIdentityResponse

§

impl Mockable for GetContestedResourcesRequest

§

impl Mockable for GetContestedResourcesResponse

§

impl Mockable for GetDataContractHistoryRequest

§

impl Mockable for GetDataContractHistoryResponse

§

impl Mockable for GetDataContractRequest

§

impl Mockable for GetDataContractResponse

§

impl Mockable for GetDataContractsRequest

§

impl Mockable for GetDataContractsResponse

§

impl Mockable for GetDocumentsRequest

§

impl Mockable for GetDocumentsResponse

§

impl Mockable for GetEpochsInfoRequest

§

impl Mockable for GetEpochsInfoResponse

§

impl Mockable for GetIdentitiesContractKeysRequest

§

impl Mockable for GetIdentitiesContractKeysResponse

§

impl Mockable for GetIdentityBalanceAndRevisionRequest

§

impl Mockable for GetIdentityBalanceAndRevisionResponse

§

impl Mockable for GetIdentityBalanceRequest

§

impl Mockable for GetIdentityBalanceResponse

§

impl Mockable for GetIdentityByPublicKeyHashRequest

§

impl Mockable for GetIdentityByPublicKeyHashResponse

§

impl Mockable for GetIdentityContractNonceRequest

§

impl Mockable for GetIdentityContractNonceResponse

§

impl Mockable for GetIdentityKeysRequest

§

impl Mockable for GetIdentityKeysResponse

§

impl Mockable for GetIdentityNonceRequest

§

impl Mockable for GetIdentityNonceResponse

§

impl Mockable for GetIdentityRequest

§

impl Mockable for GetIdentityResponse

§

impl Mockable for GetPathElementsRequest

§

impl Mockable for GetPathElementsResponse

§

impl Mockable for GetPrefundedSpecializedBalanceRequest

§

impl Mockable for GetPrefundedSpecializedBalanceResponse

§

impl Mockable for GetProofsRequest

§

impl Mockable for GetProofsResponse

§

impl Mockable for GetProtocolVersionUpgradeStateRequest

§

impl Mockable for GetProtocolVersionUpgradeStateResponse

§

impl Mockable for GetProtocolVersionUpgradeVoteStatusRequest

§

impl Mockable for GetProtocolVersionUpgradeVoteStatusResponse

§

impl Mockable for GetStatusRequest

§

impl Mockable for GetStatusResponse

§

impl Mockable for GetTotalCreditsInPlatformRequest

§

impl Mockable for GetTotalCreditsInPlatformResponse

§

impl Mockable for GetVotePollsByEndDateRequest

§

impl Mockable for GetVotePollsByEndDateResponse

§

impl Mockable for KeyRequestType

§

impl Mockable for Proof

§

impl Mockable for ResponseMetadata

§

impl Mockable for SearchKey

§

impl Mockable for SecurityLevelMap

§

impl Mockable for SpecificKeys

§

impl Mockable for StateTransitionBroadcastError

§

impl Mockable for WaitForStateTransitionResultRequest

§

impl Mockable for WaitForStateTransitionResultResponse

§

impl Mockable for WaitForStateTransitionResultRequestV0

§

impl Mockable for WaitForStateTransitionResultResponseV0

source§

impl Mockable for DocumentQuery

§

impl Mockable for BlockHeaders

§

impl Mockable for BlockHeadersWithChainLocksRequest

§

impl Mockable for BlockHeadersWithChainLocksResponse

§

impl Mockable for BloomFilter

§

impl Mockable for BroadcastTransactionRequest

§

impl Mockable for BroadcastTransactionResponse

§

impl Mockable for Chain

§

impl Mockable for GetBestBlockHeightRequest

§

impl Mockable for GetBestBlockHeightResponse

§

impl Mockable for GetBlockRequest

§

impl Mockable for GetBlockResponse

§

impl Mockable for GetBlockchainStatusRequest

§

impl Mockable for GetBlockchainStatusResponse

§

impl Mockable for GetEstimatedTransactionFeeRequest

§

impl Mockable for GetEstimatedTransactionFeeResponse

§

impl Mockable for GetMasternodeStatusRequest

§

impl Mockable for GetMasternodeStatusResponse

§

impl Mockable for GetTransactionRequest

§

impl Mockable for GetTransactionResponse

§

impl Mockable for InstantSendLockMessages

§

impl Mockable for MasternodeListRequest

§

impl Mockable for MasternodeListResponse

§

impl Mockable for Network

§

impl Mockable for NetworkFee

§

impl Mockable for RawTransactions

§

impl Mockable for Time

§

impl Mockable for TransactionsWithProofsRequest

§

impl Mockable for TransactionsWithProofsResponse

§

impl Mockable for Version