pub struct MappedAsyncCaller<'a, Out: for<'de> ArgumentDecoder<'de> + Send, Out2: for<'de> ArgumentDecoder<'de> + Send, Inner: AsyncCall<Value = Out> + Send + 'a, Map: Send + Fn(Out) -> Out2> { /* private fields */ }Expand description
A structure that applies a transform function to the result of a call. Because of constraints on the type system in Rust, both the input and output to the function must be deserializable.
Implementations§
Source§impl<'a, Out, Out2, Inner, Map> MappedAsyncCaller<'a, Out, Out2, Inner, Map>where
Out: for<'de> ArgumentDecoder<'de> + Send,
Out2: for<'de> ArgumentDecoder<'de> + Send,
Inner: AsyncCall<Value = Out> + Send + 'a,
Map: Send + Fn(Out) -> Out2,
impl<'a, Out, Out2, Inner, Map> MappedAsyncCaller<'a, Out, Out2, Inner, Map>where
Out: for<'de> ArgumentDecoder<'de> + Send,
Out2: for<'de> ArgumentDecoder<'de> + Send,
Inner: AsyncCall<Value = Out> + Send + 'a,
Map: Send + Fn(Out) -> Out2,
Sourcepub async fn call(self) -> Result<CallResponse<Out2>, AgentError>
pub async fn call(self) -> Result<CallResponse<Out2>, AgentError>
See AsyncCall::call.
Sourcepub async fn call_and_wait(self) -> Result<Out2, AgentError>
pub async fn call_and_wait(self) -> Result<Out2, AgentError>
Sourcepub fn and_then<Out3, R2, AndThen2>(
self,
and_then: AndThen2,
) -> AndThenAsyncCaller<'a, Out2, Out3, Self, R2, AndThen2>where
Out3: for<'de> ArgumentDecoder<'de> + Send + 'a,
R2: Future<Output = Result<Out3, AgentError>> + Send + 'a,
AndThen2: Send + Fn(Out2) -> R2 + 'a,
pub fn and_then<Out3, R2, AndThen2>(
self,
and_then: AndThen2,
) -> AndThenAsyncCaller<'a, Out2, Out3, Self, R2, AndThen2>where
Out3: for<'de> ArgumentDecoder<'de> + Send + 'a,
R2: Future<Output = Result<Out3, AgentError>> + Send + 'a,
AndThen2: Send + Fn(Out2) -> R2 + 'a,
See AsyncCall::and_then.
Sourcepub fn map<Out3, Map2>(
self,
map: Map2,
) -> MappedAsyncCaller<'a, Out2, Out3, Self, Map2>
pub fn map<Out3, Map2>( self, map: Map2, ) -> MappedAsyncCaller<'a, Out2, Out3, Self, Map2>
See AsyncCall::map.
Trait Implementations§
Source§impl<'a, Out, Out2, Inner, Map> AsyncCall for MappedAsyncCaller<'a, Out, Out2, Inner, Map>where
Out: for<'de> ArgumentDecoder<'de> + Send + 'a,
Out2: for<'de> ArgumentDecoder<'de> + Send + 'a,
Inner: AsyncCall<Value = Out> + Send + 'a,
Map: Send + Fn(Out) -> Out2 + 'a,
impl<'a, Out, Out2, Inner, Map> AsyncCall for MappedAsyncCaller<'a, Out, Out2, Inner, Map>where
Out: for<'de> ArgumentDecoder<'de> + Send + 'a,
Out2: for<'de> ArgumentDecoder<'de> + Send + 'a,
Inner: AsyncCall<Value = Out> + Send + 'a,
Map: Send + Fn(Out) -> Out2 + 'a,
Source§fn call<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = Result<CallResponse<Out2>, AgentError>> + 'async_trait>>where
Self: 'async_trait,
fn call<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = Result<CallResponse<Out2>, 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<Out2, AgentError>> + 'async_trait>>where
Self: 'async_trait,
fn call_and_wait<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = Result<Out2, 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<'a, Out, Out2, Inner, Map> Debug for MappedAsyncCaller<'a, Out, Out2, Inner, Map>where
Out: for<'de> ArgumentDecoder<'de> + Send,
Out2: for<'de> ArgumentDecoder<'de> + Send,
Inner: AsyncCall<Value = Out> + Send + Debug + 'a,
Map: Send + Fn(Out) -> Out2 + Debug,
impl<'a, Out, Out2, Inner, Map> Debug for MappedAsyncCaller<'a, Out, Out2, Inner, Map>where
Out: for<'de> ArgumentDecoder<'de> + Send,
Out2: for<'de> ArgumentDecoder<'de> + Send,
Inner: AsyncCall<Value = Out> + Send + Debug + 'a,
Map: Send + Fn(Out) -> Out2 + Debug,
Source§impl<'a, Out, Out2, Inner, Map> IntoFuture for MappedAsyncCaller<'a, Out, Out2, Inner, Map>where
Out: for<'de> ArgumentDecoder<'de> + Send + 'a,
Out2: for<'de> ArgumentDecoder<'de> + Send + 'a,
Inner: AsyncCall<Value = Out> + Send + 'a,
Map: Send + Fn(Out) -> Out2 + 'a,
impl<'a, Out, Out2, Inner, Map> IntoFuture for MappedAsyncCaller<'a, Out, Out2, Inner, Map>where
Out: for<'de> ArgumentDecoder<'de> + Send + 'a,
Out2: for<'de> ArgumentDecoder<'de> + Send + 'a,
Inner: AsyncCall<Value = Out> + Send + 'a,
Map: Send + Fn(Out) -> Out2 + 'a,
Source§type IntoFuture = Pin<Box<dyn Future<Output = Result<Out2, AgentError>> + 'a>>
type IntoFuture = Pin<Box<dyn Future<Output = Result<Out2, AgentError>> + 'a>>
Which kind of future are we turning this into?
Source§type Output = Result<Out2, AgentError>
type Output = Result<Out2, 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<'a, Out, Out2, Inner, Map> Freeze for MappedAsyncCaller<'a, Out, Out2, Inner, Map>
impl<'a, Out, Out2, Inner, Map> RefUnwindSafe for MappedAsyncCaller<'a, Out, Out2, Inner, Map>
impl<'a, Out, Out2, Inner, Map> Send for MappedAsyncCaller<'a, Out, Out2, Inner, Map>
impl<'a, Out, Out2, Inner, Map> Sync for MappedAsyncCaller<'a, Out, Out2, Inner, Map>
impl<'a, Out, Out2, Inner, Map> Unpin for MappedAsyncCaller<'a, Out, Out2, Inner, Map>
impl<'a, Out, Out2, Inner, Map> UnwindSafe for MappedAsyncCaller<'a, Out, Out2, Inner, Map>
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