pub struct DeployBuilder<Canister, C: Caller> {
pub provider: C::Provider,
pub caller: C,
pub canister_id: Option<Principal>,
pub mode: DeployMode,
pub settings: CanisterSettings,
pub cycles: u128,
pub wasm: Vec<u8>,
pub args: Result<Vec<u8>, Error>,
pub new: fn(&C, Principal) -> Canister,
}
Expand description
Builder struct for configuring and performing a canister deployment.
Provides an ergonomic way to:
- Set the deployment mode (create, install, upgrade, reinstall)
- Attach initial cycles
- Define WASM module and settings
- Inject candid arguments
- Produce a typed client interface
Fields§
§provider: C::Provider
Provider that performs actual deployment (e.g. PocketIc).
caller: C
The logical caller for interactions post-deployment.
canister_id: Option<Principal>
Optional canister ID for pre-existing canisters.
mode: DeployMode
Deployment mode (create, install, etc.).
settings: CanisterSettings
Canister configuration (controllers, memory allocation, compute allocation, etc.).
cycles: u128
Initial cycles to add.
wasm: Vec<u8>
WASM module to install.
args: Result<Vec<u8>, Error>
Candid-encoded constructor arguments.
new: fn(&C, Principal) -> Canister
Function to wrap a raw Principal
in a user-defined canister type.
Implementations§
Source§impl<Canister, C: Caller> DeployBuilder<Canister, C>
impl<Canister, C: Caller> DeployBuilder<Canister, C>
pub fn with_canister_id(self, canister_id: Principal) -> Self
pub fn with_controllers(self, controllers: Vec<Principal>) -> Self
pub fn with_cycles(self, cycles: u128) -> Self
pub fn with_settings(self, settings: CanisterSettings) -> Self
pub fn with_wasm(self, wasm: Vec<u8>) -> Self
pub fn with_install(self) -> Self
pub fn with_upgrade(self) -> Self
pub fn with_reinstall(self) -> Self
Sourcepub async fn maybe_call(self) -> Result<Canister, DeployError>
pub async fn maybe_call(self) -> Result<Canister, DeployError>
Execute the deployment, returning either a constructed canister interface or an error.
Auto Trait Implementations§
impl<Canister, C> Freeze for DeployBuilder<Canister, C>
impl<Canister, C> RefUnwindSafe for DeployBuilder<Canister, C>
impl<Canister, C> Send for DeployBuilder<Canister, C>
impl<Canister, C> Sync for DeployBuilder<Canister, C>
impl<Canister, C> Unpin for DeployBuilder<Canister, C>
impl<Canister, C> UnwindSafe for DeployBuilder<Canister, C>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more