Struct abstract_testing::prelude::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> ) -> Option<Vec<Coin>>
pub fn set_denom_metadata(&mut self, denom_metadata: &[DenomMetadata])
pub fn update_ibc(&mut self, port_id: &str, channels: &[IbcChannel])
pub fn update_wasm<WH>(&mut self, handler: WH)
pub fn with_custom_handler<CH>(self, handler: CH) -> MockQuerier<C>
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
impl Default for MockQuerier
source§fn default() -> MockQuerier
fn default() -> MockQuerier
Returns the “default value” for a type. Read more
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§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
Casts
self
to type T
. The semantics of numeric casting with the as
operator are followed, so <T as As>::as_::<U>
can be used in the same way as T as U
for numeric conversions. Read moresource§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