[][src]Macro stakker::ret_to

macro_rules! ret_to {
    ([$cx:expr], move |$this:ident, $cxid:ident, $arg:ident : Option<$t:ty>| $($body:tt)+) => { ... };
    ($($x:tt)*) => { ... };
}

Create a Ret instance for actor calls

This is guaranteed to be called exactly once, even if dropped. The message is passed as Some(msg) if called normally, or as None if the Ret instance was dropped (e.g. if it couldn't be delivered somewhere). The underlying closure is a FnOnce, so non-Copy types can be passed. The syntax is the same as for fwd_to!, and the message types are specified as normal. However the message is received in a single argument on the receiving method, either Option<type> for a single type, or else Option<(type1, type2...)>.

This example is not tested
ret_to!(...arguments-as-for-fwd_to-macro...);

The closure form must use a single Option as above as the argument type, containing all the types passed from the Ret.

Implemented using Ret::to_actor or Ret::to_actor_prep.