[−][src]Macro stakker::call
Queue an actor call or inline code for execution soon
The call is deferred to the main defer queue, which will execute as soon as possible.
Note that in the examples below, in general there can be any number of arguments, including zero. The number of arguments depends on the signature of the called method. All of these values may be full Rust expressions, which are evaluated at the call-site before queuing the call. The exceptions are method names, types/paths and argument names for closures which may be any valid identifier.
Note that the part in square brackets gives the context of the
call. For calls to the same actor, this is normally just cx
.
For calls to another actor, normally the actor and a Core
reference should be given (e.g. cx
), but if the Core
reference is omitted, the actor's built-in Deferrer
is used
instead. There is no difference in functionality (apart from
borrowing issues), just that Core
is more likely to be in
cache.
// Call a method in this actor or in another actor call!([cx], method(arg1, arg2...)); call!([actorxx, core], method(arg1, arg2...)); // Call a method whilst the actor is in the 'Prep' state, before it // has a `Self` instance. `Type` here in the first line may be `Self`. call!([cx], Type::method(arg1, arg2...)); call!([cx], <path::Type>::method(arg1, arg2...)); call!([actoryy, core], Type::method(arg1, arg2...)); call!([actorzz, core], <path::Type>::method(arg1, arg2...)); // Use the actor's built-in Deferrer; doesn't require Core call!([actorxx], method(arg1, arg2...)); call!([actoryy], Type::method(arg1, arg2...)); call!([actorzz], <path::Type>::method(arg1, arg2...)); // Defer a call to inline code call!([cx], move |this, cx| ...code...); // Inline code which refers to this actor call!([core], move |stakker| ...code...); // Generic inline code (`&mut Stakker` arg)
Implemented using Core::defer
, Actor::defer
,
Actor::apply
and Actor::apply_prep
.