pub trait GenericModule {
// Required methods
fn instantiate_value(
&mut self,
deps: &mut DepsMut<'_>,
env: &Env,
info: &MessageInfo,
msg: &Value,
) -> Result<Response, String>;
fn execute_value(
&mut self,
deps: &mut DepsMut<'_>,
env: Env,
info: MessageInfo,
msg: &Value,
) -> Result<Response, String>;
fn query_value(
&self,
deps: &Deps<'_>,
env: Env,
msg: &Value,
) -> StdResult<Binary>;
}Expand description
A dynamically typed module.
GenericModules accept JSON values as their messages and return them as
their results. Errors returned by GenericModules are strings. This trait
was created to enable a simple dynamic dispatch of messages sent to the
contract by the Manager.
Required Methods§
Sourcefn instantiate_value(
&mut self,
deps: &mut DepsMut<'_>,
env: &Env,
info: &MessageInfo,
msg: &Value,
) -> Result<Response, String>
fn instantiate_value( &mut self, deps: &mut DepsMut<'_>, env: &Env, info: &MessageInfo, msg: &Value, ) -> Result<Response, String>
A generic implementation of Module::instantiate
Sourcefn execute_value(
&mut self,
deps: &mut DepsMut<'_>,
env: Env,
info: MessageInfo,
msg: &Value,
) -> Result<Response, String>
fn execute_value( &mut self, deps: &mut DepsMut<'_>, env: Env, info: MessageInfo, msg: &Value, ) -> Result<Response, String>
A generic implementation of Module::execute
Implementors§
impl<T, A, B, C, D, E> GenericModule for Twhere
A: for<'de> Deserialize<'de>,
B: for<'de> Deserialize<'de>,
C: for<'de> Deserialize<'de>,
D: Serialize,
E: Display,
T: Module<InstantiateMsg = A, ExecuteMsg = B, QueryMsg = C, QueryResp = D, Error = E>,
An implementation of GenericModule for all valid implementations of Module.