GenericModule

Trait GenericModule 

Source
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§

Source

fn instantiate_value( &mut self, deps: &mut DepsMut<'_>, env: &Env, info: &MessageInfo, msg: &Value, ) -> Result<Response, String>

A generic implementation of Module::instantiate

Source

fn execute_value( &mut self, deps: &mut DepsMut<'_>, env: Env, info: MessageInfo, msg: &Value, ) -> Result<Response, String>

A generic implementation of Module::execute

Source

fn query_value( &self, deps: &Deps<'_>, env: Env, msg: &Value, ) -> StdResult<Binary>

A generic implementation of Module::query

Implementors§

Source§

impl<T, A, B, C, D, E> GenericModule for T
where 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.