macro_rules! query { ([$actor:expr, $stakker:expr], $method:ident( $($x:expr),* $(,)? )) => { ... }; }
Expand description
Synchronously query an actor for information
This requires a &mut Stakker
and is intended for interfacing the
actor system to external code. It makes a synchronous call to an
actor method, and the actor method may return data from its own
state. However if the actor is not yet in the Ready state, or
has terminated, then None
will be returned. No attempt is made
to handle the call asynchronously, e.g. to queue it. So this is
only intended to aid in interfacing the actor system to non-actor
code.
ⓘ
// Where `s` is a `&mut Stakker`
match query!([actor, s], method(args...)) {
None => ..., // Actor not in ready state
Some(result) => ..., // Successful call
}
Implemented using Actor::query
.