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
sourceimpl<'agent> Canister<'agent>
impl<'agent> Canister<'agent>
sourcepub fn canister_id_<'canister: 'agent>(&'canister self) -> &'_ Principal
pub fn canister_id_<'canister: 'agent>(&'canister self) -> &'_ Principal
Get the canister ID of this canister.
sourcepub fn update_<'canister: 'agent>(
&'canister self,
method_name: &str
) -> AsyncCallBuilder<'agent, 'canister>
pub fn update_<'canister: 'agent>(
&'canister self,
method_name: &str
) -> AsyncCallBuilder<'agent, 'canister>
Create an AsyncCallBuilder to do an update call.
sourcepub fn query_<'canister: 'agent>(
&'canister self,
method_name: &str
) -> SyncCallBuilder<'agent, 'canister>
pub fn query_<'canister: 'agent>(
&'canister self,
method_name: &str
) -> SyncCallBuilder<'agent, 'canister>
Create a SyncCallBuilder to do a query call.
sourcepub async fn wait<'canister: 'agent, W>(
&'canister self,
request_id: RequestId,
waiter: W
) -> Result<Vec<u8>, AgentError>where
W: Waiter,
pub async fn wait<'canister: 'agent, W>(
&'canister self,
request_id: RequestId,
waiter: W
) -> Result<Vec<u8>, AgentError>where
W: Waiter,
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.
sourcepub fn builder() -> CanisterBuilder<'agent>
pub fn builder() -> CanisterBuilder<'agent>
Create a CanisterBuilder instance to build a canister abstraction.
Trait Implementations
Auto Trait Implementations
impl<'agent> !RefUnwindSafe for Canister<'agent>
impl<'agent> Send for Canister<'agent>
impl<'agent> Sync for Canister<'agent>
impl<'agent> Unpin for Canister<'agent>
impl<'agent> !UnwindSafe for Canister<'agent>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more