Function ractor::rpc::call_and_forward
source · pub fn call_and_forward<TMessage, TForwardMessage, TReply, TMsgBuilder, FwdMapFn>(
actor: &ActorCell,
msg_builder: TMsgBuilder,
response_forward: ActorCell,
forward_mapping: FwdMapFn,
timeout_option: Option<Duration>
) -> Result<JoinHandle<CallResult<Result<(), MessagingErr<TForwardMessage>>>>, MessagingErr<TMessage>>
Expand description
Send a message asynchronously to another actor, waiting in a new task for the reply and then forwarding the reply to a followup-actor. If this CallResult from the first actor is not success, the forward is not sent.
actor
- A reference to the ActorCell to communicate withmsg_builder
- The FnOnce to construct the messageresponse_forward
- The ActorCell to forward the message toforward_mapping
- The FnOnce which maps the response from theactor
ActorCell’s reply message type to theresponse_forward
ActorCell’s message typetimeout_option
- An optional Duration which represents the amount of time until the operation times out
Returns: A [JoinHandle<CallResult<()>>] which can be awaited to see if the forward was successful or ignored