CallHandler

Trait CallHandler 

Source
pub trait CallHandler {
    // Required methods
    fn accept(&self, canister_id: &Principal, method: &str) -> bool;
    fn perform(
        &self,
        caller: &Principal,
        cycles: u64,
        canister_id: &Principal,
        method: &str,
        args_raw: &Vec<u8>,
        ctx: Option<&mut MockContext>,
    ) -> (CallResult<Vec<u8>>, u64);
}
Expand description

Anything that could be used to simulate a inter-canister call.

Required Methods§

Source

fn accept(&self, canister_id: &Principal, method: &str) -> bool

Whatever the handler can handle the given call or not, if this method returns false, we skip this handler and try to find the next handler that can handle the call.

Source

fn perform( &self, caller: &Principal, cycles: u64, canister_id: &Principal, method: &str, args_raw: &Vec<u8>, ctx: Option<&mut MockContext>, ) -> (CallResult<Vec<u8>>, u64)

Perform the call using this handler. Only called if accept() first returned true.

Implementors§