Trait Caller

Source
pub trait Caller {
    type Provider: Provider;

    // Required method
    fn call<ResultType>(
        &self,
        canister_id: Principal,
        call_mode: CallMode,
        method: &str,
        args: Result<Vec<u8>, Error>,
    ) -> CallBuilder<ResultType, Self::Provider>
       where ResultType: for<'a> Deserialize<'a> + CandidType;
}
Expand description

Trait for objects that can initiate canister calls.

Required Associated Types§

Source

type Provider: Provider

Required Methods§

Source

fn call<ResultType>( &self, canister_id: Principal, call_mode: CallMode, method: &str, args: Result<Vec<u8>, Error>, ) -> CallBuilder<ResultType, Self::Provider>
where ResultType: for<'a> Deserialize<'a> + CandidType,

Initiate a call to a canister method.

§Parameters
  • canister_id: The target canister’s principal.
  • call_mode: Whether this is a query or update.
  • method: Method name to call.
  • args: Encoded Candid arguments or error.
§Returns

A configured CallBuilder to execute the call.

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.

Implementors§