Attribute Macro pool_worker
#[pool_worker]Expand description
Derive the one ordinary Behavior implementation for a
pool worker from its assignment transition.
The authored transition receives Assignment and completes it directly;
the generated protocol and parent-completion request remain interpreter
machinery rather than application syntax.
Omitting a required domain declaration is rejected at the attribute:
struct Worker;
#[behavior_actors::atomic::pool_worker(addr = behavior::MailAddr)]
impl Worker {
fn transition(&mut self, assignment: behavior_actors::atomic::Assignment<u8>) -> WorkerActed<Self> {
Ok(behavior::Actions::cont().with_send(assignment.complete(10_u16)))
}
}The transition must consume one assignment rather than an unrelated input:
struct Worker;
#[behavior_actors::atomic::pool_worker(addr = behavior::MailAddr, result = u16)]
impl Worker {
fn transition(&mut self, job: u8) -> WorkerActed<Self> {
loop {}
}
}Derive one pool worker’s ordinary actor protocol and behavior from its assignment transition.
This attribute owns syntax only. The generated send product is the existing
typed parent request carrying the opaque completion produced by
Assignment::complete; assignment authority and delivery remain owned by
the Behavior Actors pool protocol and the runtime interpreter.