Struct fadroma::prelude::testing::MockQuerier
source · pub struct MockQuerier<C = Empty>where
C: DeserializeOwned,{ /* private fields */ }
Expand description
MockQuerier holds an immutable table of bank balances and configurable handlers for Wasm queries and custom queries.
Implementations§
source§impl<C> MockQuerier<C>where
C: DeserializeOwned,
impl<C> MockQuerier<C>where C: DeserializeOwned,
pub fn new(balances: &[(&str, &[Coin])]) -> MockQuerier<C>
pub fn update_balance( &mut self, addr: impl Into<String>, balance: Vec<Coin, Global> ) -> Option<Vec<Coin, Global>>
pub fn update_staking( &mut self, denom: &str, validators: &[Validator], delegations: &[FullDelegation] )
pub fn update_wasm<WH>(&mut self, handler: WH)where WH: 'static + Fn(&WasmQuery) -> SystemResult<ContractResult<Binary>>,
pub fn with_custom_handler<CH>(self, handler: CH) -> MockQuerier<C>where CH: 'static + Fn(&C) -> SystemResult<ContractResult<Binary>>,
source§impl<C> MockQuerier<C>where
C: CustomQuery + DeserializeOwned,
impl<C> MockQuerier<C>where C: CustomQuery + DeserializeOwned,
pub fn handle_query( &self, request: &QueryRequest<C> ) -> SystemResult<ContractResult<Binary>>
Trait Implementations§
source§impl Default for MockQuerier<Empty>
impl Default for MockQuerier<Empty>
source§impl<C> Querier for MockQuerier<C>where
C: CustomQuery + DeserializeOwned,
impl<C> Querier for MockQuerier<C>where C: CustomQuery + DeserializeOwned,
source§fn raw_query(&self, bin_request: &[u8]) -> SystemResult<ContractResult<Binary>>
fn raw_query(&self, bin_request: &[u8]) -> SystemResult<ContractResult<Binary>>
raw_query is all that must be implemented for the Querier.
This allows us to pass through binary queries from one level to another without
knowing the custom format, or we can decode it, with the knowledge of the allowed
types. People using the querier probably want one of the simpler auto-generated
helper methods
Auto Trait Implementations§
impl<C = Empty> !RefUnwindSafe for MockQuerier<C>
impl<C = Empty> !Send for MockQuerier<C>
impl<C = Empty> !Sync for MockQuerier<C>
impl<C> Unpin for MockQuerier<C>
impl<C = Empty> !UnwindSafe for MockQuerier<C>
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