pub struct Canister<'agent> { /* private fields */ }
Expand description
Create an encapsulation of a Canister running on the Internet Computer. This supports making calls to methods, installing code if needed, and various utilities related to a canister.
This is the higher level construct for talking to a canister on the Internet Computer.
Implementations§
source§impl<'agent> Canister<'agent>
impl<'agent> Canister<'agent>
sourcepub fn canister_id_(&self) -> &Principal
pub fn canister_id_(&self) -> &Principal
Get the canister ID of this canister.
Prefer using canister_id
instead.
sourcepub fn canister_id(&self) -> &Principal
pub fn canister_id(&self) -> &Principal
Get the canister ID of this canister.
sourcepub fn update_<'canister>(
&'canister self,
method_name: &str
) -> AsyncCallBuilder<'agent, 'canister>
pub fn update_<'canister>( &'canister self, method_name: &str ) -> AsyncCallBuilder<'agent, 'canister>
Create an AsyncCallBuilder to do an update call.
sourcepub fn update<'canister>(
&'canister self,
method_name: &str
) -> AsyncCallBuilder<'agent, 'canister>
pub fn update<'canister>( &'canister self, method_name: &str ) -> AsyncCallBuilder<'agent, 'canister>
Create an AsyncCallBuilder to do an update call.
Prefer using update
instead.
sourcepub fn query_<'canister>(
&'canister self,
method_name: &str
) -> SyncCallBuilder<'agent, 'canister>
pub fn query_<'canister>( &'canister self, method_name: &str ) -> SyncCallBuilder<'agent, 'canister>
Create a SyncCallBuilder to do a query call.
Prefer using query
instead.
sourcepub fn query<'canister>(
&'canister self,
method_name: &str
) -> SyncCallBuilder<'agent, 'canister>
pub fn query<'canister>( &'canister self, method_name: &str ) -> SyncCallBuilder<'agent, 'canister>
Create a SyncCallBuilder to do a query call.
sourcepub async fn wait<'canister>(
&'canister self,
request_id: RequestId
) -> Result<Vec<u8>, AgentError>
pub async fn wait<'canister>( &'canister self, request_id: RequestId ) -> Result<Vec<u8>, AgentError>
Call request_status on the RequestId in a loop and return the response as a byte vector.
sourcepub fn clone_with_(&self, id: Principal) -> Self
pub fn clone_with_(&self, id: Principal) -> Self
Creates a copy of this canister, changing the canister ID to the provided principal.
Prefer using clone_with
instead.
sourcepub fn clone_with(&self, id: Principal) -> Self
pub fn clone_with(&self, id: Principal) -> Self
Creates a copy of this canister, changing the canister ID to the provided principal.
sourcepub fn builder() -> CanisterBuilder<'agent>
pub fn builder() -> CanisterBuilder<'agent>
Create a CanisterBuilder instance to build a canister abstraction.