Skip to main content

CandidCallExt

Trait CandidCallExt 

Source
pub trait CandidCallExt {
    // Required methods
    fn update_candid_as<T, A>(
        &self,
        canister_id: Principal,
        caller: Principal,
        method: &str,
        args: A,
        limits: DecodeLimits,
    ) -> Result<T, CandidCallError>
       where T: CandidType + DeserializeOwned,
             A: ArgumentEncoder;
    fn query_candid_as<T, A>(
        &self,
        canister_id: Principal,
        caller: Principal,
        method: &str,
        args: A,
        limits: DecodeLimits,
    ) -> Result<T, CandidCallError>
       where T: CandidType + DeserializeOwned,
             A: ArgumentEncoder;

    // Provided methods
    fn update_candid<T, A>(
        &self,
        canister_id: Principal,
        method: &str,
        args: A,
        limits: DecodeLimits,
    ) -> Result<T, CandidCallError>
       where T: CandidType + DeserializeOwned,
             A: ArgumentEncoder { ... }
    fn query_candid<T, A>(
        &self,
        canister_id: Principal,
        method: &str,
        args: A,
        limits: DecodeLimits,
    ) -> Result<T, CandidCallError>
       where T: CandidType + DeserializeOwned,
             A: ArgumentEncoder { ... }
}
Expand description

Typed Candid calls with caller-selected reply limits and contextual failures.

Every call requires explicit DecodeLimits; these bound reply decoding, not PocketIC transport duration or canister execution.

Required Methods§

Source

fn update_candid_as<T, A>( &self, canister_id: Principal, caller: Principal, method: &str, args: A, limits: DecodeLimits, ) -> Result<T, CandidCallError>

Encode and execute an update call as an explicit caller.

Source

fn query_candid_as<T, A>( &self, canister_id: Principal, caller: Principal, method: &str, args: A, limits: DecodeLimits, ) -> Result<T, CandidCallError>

Encode and execute a query call as an explicit caller.

Provided Methods§

Source

fn update_candid<T, A>( &self, canister_id: Principal, method: &str, args: A, limits: DecodeLimits, ) -> Result<T, CandidCallError>

Encode and execute an anonymous update call, then decode its result.

Source

fn query_candid<T, A>( &self, canister_id: Principal, method: &str, args: A, limits: DecodeLimits, ) -> Result<T, CandidCallError>

Encode and execute an anonymous query call, then decode its result.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§