pub struct CallBuilder<R: for<'a> Deserialize<'a> + CandidType, P: Provider> {
pub provider: P,
pub canister_id: Principal,
pub call_mode: CallMode,
pub method: String,
pub args: Result<Vec<u8>, Error>,
pub _result: PhantomData<R>,
}
Expand description
A builder for creating and executing canister method calls in tests.
Generic over:
R
: The expected result type of the method.P
: The provider type (e.g.,IcpUser
or PocketIC).
Fields§
§provider: P
The test environment provider.
canister_id: Principal
The principal of the canister to call.
call_mode: CallMode
The mode of the call (query or update).
method: String
The name of the method being called.
args: Result<Vec<u8>, Error>
Candid-encoded call arguments, or an encoding error.
_result: PhantomData<R>
Phantom type to carry the result type without storing it.
Implementations§
Source§impl<R: for<'a> Deserialize<'a> + CandidType, P: Provider> CallBuilder<R, P>
impl<R: for<'a> Deserialize<'a> + CandidType, P: Provider> CallBuilder<R, P>
Sourcepub fn with_caller<C: Caller>(self, caller: C) -> CallBuilder<R, C::Provider>
pub fn with_caller<C: Caller>(self, caller: C) -> CallBuilder<R, C::Provider>
Setup caller of the bulider
Sourcepub fn with_update(self) -> Self
pub fn with_update(self) -> Self
Switch caller mode to update
Sourcepub async fn maybe_call(self) -> Result<R, CallError>
pub async fn maybe_call(self) -> Result<R, CallError>
Auto Trait Implementations§
impl<R, P> Freeze for CallBuilder<R, P>where
P: Freeze,
impl<R, P> RefUnwindSafe for CallBuilder<R, P>where
P: RefUnwindSafe,
R: RefUnwindSafe,
impl<R, P> Send for CallBuilder<R, P>
impl<R, P> Sync for CallBuilder<R, P>
impl<R, P> Unpin for CallBuilder<R, P>
impl<R, P> UnwindSafe for CallBuilder<R, P>where
P: UnwindSafe,
R: UnwindSafe,
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