pub trait Query: Serialize {
const BLOCK_SIZE: usize;
// Provided method
fn query<C: CustomQuery, T: DeserializeOwned>(
&self,
querier: QuerierWrapper<'_, C>,
code_hash: String,
contract_addr: String,
) -> StdResult<T> { ... }
}
Expand description
A trait marking types that define the query message(s) of a contract
This trait requires specifying a padding block size and provides a method to query a contract
Required Associated Constants§
Sourceconst BLOCK_SIZE: usize
const BLOCK_SIZE: usize
pad the message to blocks of this size
Provided Methods§
Sourcefn query<C: CustomQuery, T: DeserializeOwned>(
&self,
querier: QuerierWrapper<'_, C>,
code_hash: String,
contract_addr: String,
) -> StdResult<T>
fn query<C: CustomQuery, T: DeserializeOwned>( &self, querier: QuerierWrapper<'_, C>, code_hash: String, contract_addr: String, ) -> StdResult<T>
Returns StdResult
Tries to query a contract and deserialize the query response. The BLOCK_SIZE specified in the implementation is used when padding the message
§Arguments
querier
- a reference to the Querier dependency of the querying contractcallback_code_hash
- String holding the code hash of the contract to be queriedcontract_addr
- address of the contract being queried
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.