/// Ships the wasm code to the given canister.
Ships the wasm code to the given canister.
Ships the wasm code to the given canister .
pub async fn install(
        self,
        canister: &mut Canister<'a>,
        payload: Vec<u8>,
    ) -> Result<(), String> {
        let install_args = InstallCodeArgs::new(
            self.mode,
            canister.canister_id,
            self.wasm.0.clone(),
            payload,
            self.compute_allocation,
            self.memory_allocation,
            self.query_allocation,
        );
        eprintln!("Install args: {}", &install_args);
        match self.runtime {
            Runtime::Local(local_runtime) => local_runtime
                .install_canister_helper(install_args)
                .map_err(|e| e.to_string())
                .map(|_| {}),
            Runtime::Remote(c) => c.agent.install_canister(install_args).await,
        }?;
        canister.wasm = Some(self.wasm);
        Ok(())
    }
pub async fn install ( self , canister : & mut Canister < ' a > , payload : Vec < u8 > , ) -> Result < ( ) , String > { let install_args = InstallCodeArgs :: new ( self . mode , canister . canister_id , self . wasm . 0 . clone ( ) , payload , self . compute_allocation , self . memory_allocation , self . query_allocation , ) ; eprintln ! ( " " install_args ) ; match self . runtime { Runtime :: Local ( local_runtime ) => local_runtime . install_canister_helper ( install_args ) . map_err ( | e | e . to_string ( ) ) . map ( | _ | { } ) , Runtime :: Remote ( c ) => c . agent . install_canister ( install_args ) . await , } ? ; canister . wasm = Some ( self . wasm ) ; Ok ( ( ) ) }
Ships the wasm code to the given canister.
Ships the wasm code to the given canister .
self
canister
&mut Canister<'a>
payload
Vec<u8>