InstallChunkedCodeBuilder

Struct InstallChunkedCodeBuilder 

Source
pub struct InstallChunkedCodeBuilder<'agent, 'canister> { /* private fields */ }
Expand description

A builder for an install_chunked_code call.

Implementations§

Source§

impl<'agent: 'canister, 'canister> InstallChunkedCodeBuilder<'agent, 'canister>

Source

pub fn builder( canister: &'canister Canister<'agent>, target_canister: Principal, wasm_module_hash: &[u8], ) -> Self

Create an InstallChunkedCodeBuilder.

Source

pub fn with_chunk_hashes(self, chunk_hashes: Vec<ChunkHash>) -> Self

Set the chunks to install. These must previously have been set with ManagementCanister::upload_chunk.

Source

pub fn with_store_canister(self, store_canister: Principal) -> Self

Set the canister to pull uploaded chunks from. By default this is the same as the target canister.

Source

pub fn with_arg(self, argument: impl CandidType) -> Self

Set the argument to the installation, which will be passed to the init method of the canister. Can be called at most once.

Source

pub fn with_args(self, argument: impl ArgumentEncoder) -> Self

Set the argument with multiple arguments as tuple to the installation, which will be passed to the init method of the canister. Can be called at most once.

Source

pub fn with_raw_arg(self, argument: Vec<u8>) -> Self

Set the argument passed in to the canister with raw bytes. Can be called at most once.

Source

pub fn with_install_mode(self, mode: CanisterInstallMode) -> Self

Source

pub fn build(self) -> Result<impl 'agent + AsyncCall<Value = ()>, AgentError>

Create an AsyncCall implementation that, when called, will install the canister.

Source

pub async fn call(self) -> Result<CallResponse<()>, AgentError>

Make the call. This is equivalent to AsyncCall::call.

Source

pub async fn call_and_wait(self) -> Result<(), AgentError>

Make the call. This is equivalent to AsyncCall::call_and_wait.

Trait Implementations§

Source§

impl<'agent, 'canister: 'agent> AsyncCall for InstallChunkedCodeBuilder<'agent, 'canister>

Source§

type Value = ()

The return type of the Candid function being called.
Source§

fn call<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Result<CallResponse<()>, AgentError>> + 'async_trait>>
where Self: 'async_trait,

Execute the call, but returns the RequestId. Waiting on the request Id must be managed by the caller using the Agent directly. Read more
Source§

fn call_and_wait<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + 'async_trait>>
where Self: 'async_trait,

Execute the call, and wait for an answer using an exponential-backoff strategy. The return type is encoded in the trait.
Source§

fn and_then<'a, Out2, R, AndThen>( self, and_then: AndThen, ) -> AndThenAsyncCaller<'a, Self::Value, Out2, Self, R, AndThen>
where Self: Sized + Send + 'a, Out2: for<'de> ArgumentDecoder<'de> + Send + 'a, R: Future<Output = Result<Out2, AgentError>> + Send + 'a, AndThen: Send + Fn(Self::Value) -> R + 'a,

Apply a transformation function after the call has been successful. The transformation is applied with the result. Read more
Source§

fn map<'a, Out, Map>( self, map: Map, ) -> MappedAsyncCaller<'a, Self::Value, Out, Self, Map>
where Self: Sized + Send + 'a, Out: for<'de> ArgumentDecoder<'de> + Send + 'a, Map: Send + Fn(Self::Value) -> Out + 'a,

Apply a transformation function after the call has been successful. Equivalent to .and_then(|x| async { map(x) }).
Source§

impl<'agent, 'canister> Debug for InstallChunkedCodeBuilder<'agent, 'canister>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'agent, 'canister: 'agent> IntoFuture for InstallChunkedCodeBuilder<'agent, 'canister>

Source§

type IntoFuture = Pin<Box<dyn Future<Output = Result<(), AgentError>> + 'agent>>

Which kind of future are we turning this into?
Source§

type Output = Result<(), AgentError>

The output that the future will produce on completion.
Source§

fn into_future(self) -> Self::IntoFuture

Creates a future from a value. Read more

Auto Trait Implementations§

§

impl<'agent, 'canister> Freeze for InstallChunkedCodeBuilder<'agent, 'canister>

§

impl<'agent, 'canister> !RefUnwindSafe for InstallChunkedCodeBuilder<'agent, 'canister>

§

impl<'agent, 'canister> Send for InstallChunkedCodeBuilder<'agent, 'canister>

§

impl<'agent, 'canister> Sync for InstallChunkedCodeBuilder<'agent, 'canister>

§

impl<'agent, 'canister> Unpin for InstallChunkedCodeBuilder<'agent, 'canister>

§

impl<'agent, 'canister> !UnwindSafe for InstallChunkedCodeBuilder<'agent, 'canister>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T