pub struct AsyncCaller<'agent, Out>where
Out: for<'de> ArgumentDecoder<'de> + Send,{ /* private fields */ }Expand description
An async caller, encapsulating a call to an update method.
Implementations§
Source§impl<'agent, Out> AsyncCaller<'agent, Out>where
Out: for<'de> ArgumentDecoder<'de> + Send + 'agent,
impl<'agent, Out> AsyncCaller<'agent, Out>where
Out: for<'de> ArgumentDecoder<'de> + Send + 'agent,
Sourcepub fn build_call(self) -> Result<UpdateBuilder<'agent>, AgentError>
pub fn build_call(self) -> Result<UpdateBuilder<'agent>, AgentError>
Build an UpdateBuilder call that can be used directly with the Agent. This is
essentially downleveling this type into the lower level [ic-agent] abstraction.
Sourcepub async fn call(self) -> Result<CallResponse<Out>, AgentError>
pub async fn call(self) -> Result<CallResponse<Out>, AgentError>
See AsyncCall::call.
Sourcepub async fn call_and_wait(self) -> Result<Out, AgentError>
pub async fn call_and_wait(self) -> Result<Out, AgentError>
Sourcepub async fn call_and_wait_one<T>(self) -> Result<T, AgentError>where
T: DeserializeOwned + CandidType,
pub async fn call_and_wait_one<T>(self) -> Result<T, AgentError>where
T: DeserializeOwned + CandidType,
Equivalent to calling AsyncCall::call_and_wait with the expected return type (T,).
Sourcepub fn map<Out2, Map>(
self,
map: Map,
) -> MappedAsyncCaller<'agent, Out, Out2, Self, Map>
pub fn map<Out2, Map>( self, map: Map, ) -> MappedAsyncCaller<'agent, Out, Out2, Self, Map>
See AsyncCall::map.
Trait Implementations§
Source§impl<'agent, Out> AsyncCall for AsyncCaller<'agent, Out>where
Out: for<'de> ArgumentDecoder<'de> + Send + 'agent,
impl<'agent, Out> AsyncCall for AsyncCaller<'agent, Out>where
Out: for<'de> ArgumentDecoder<'de> + Send + 'agent,
Source§fn call<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = Result<CallResponse<Out>, AgentError>> + 'async_trait>>where
Self: 'async_trait,
fn call<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = Result<CallResponse<Out>, 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 moreSource§fn call_and_wait<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = Result<Out, AgentError>> + 'async_trait>>where
Self: 'async_trait,
fn call_and_wait<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = Result<Out, 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>
fn and_then<'a, Out2, R, AndThen>( self, and_then: AndThen, ) -> AndThenAsyncCaller<'a, Self::Value, Out2, Self, R, AndThen>
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>
fn map<'a, Out, Map>( self, map: Map, ) -> MappedAsyncCaller<'a, Self::Value, Out, Self, Map>
Apply a transformation function after the call has been successful. Equivalent to
.and_then(|x| async { map(x) }).Source§impl<'agent, Out> Debug for AsyncCaller<'agent, Out>
impl<'agent, Out> Debug for AsyncCaller<'agent, Out>
Source§impl<'agent, Out> IntoFuture for AsyncCaller<'agent, Out>where
Out: for<'de> ArgumentDecoder<'de> + Send + 'agent,
impl<'agent, Out> IntoFuture for AsyncCaller<'agent, Out>where
Out: for<'de> ArgumentDecoder<'de> + Send + 'agent,
Source§type IntoFuture = Pin<Box<dyn Future<Output = Result<Out, AgentError>> + 'agent>>
type IntoFuture = Pin<Box<dyn Future<Output = Result<Out, AgentError>> + 'agent>>
Which kind of future are we turning this into?
Source§type Output = Result<Out, AgentError>
type Output = Result<Out, AgentError>
The output that the future will produce on completion.
Source§fn into_future(self) -> Self::IntoFuture
fn into_future(self) -> Self::IntoFuture
Creates a future from a value. Read more
Auto Trait Implementations§
impl<'agent, Out> Freeze for AsyncCaller<'agent, Out>
impl<'agent, Out> !RefUnwindSafe for AsyncCaller<'agent, Out>
impl<'agent, Out> Send for AsyncCaller<'agent, Out>
impl<'agent, Out> Sync for AsyncCaller<'agent, Out>where
Out: Sync,
impl<'agent, Out> Unpin for AsyncCaller<'agent, Out>where
Out: Unpin,
impl<'agent, Out> !UnwindSafe for AsyncCaller<'agent, Out>
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