Skip to main content

WorkerSource

Trait WorkerSource 

Source
pub trait WorkerSource<Role, Worker, Plan>: Send
where Worker: Behavior + Send, Plan: ActivationPlan,
{ type WorkerRejection: Send; type SourceRejection: Send; }
Expand description

Static declaration implemented by one concrete Bombay worker-source capability.

This trait declares types only. It deliberately has no method: the source is an affine capability interpreted by Bombay, not an application callback invoked by FixedSupervisor.

A source declared for another worker cannot prepare this supervisor:

ⓘ
struct DeclaredWorker;
#[behavior::behavior(addr = behavior::MailAddr, message = behavior::Never)]
impl DeclaredWorker {
    fn receive(&mut self, _: behavior::MailAddr, message: behavior::Never)
        -> behavior::BehaviorActed<Self> {
        match message {}
    }
}
struct OtherWorker;
#[behavior::behavior(addr = behavior::MailAddr, message = behavior::Never)]
impl OtherWorker {
    fn receive(&mut self, _: behavior::MailAddr, message: behavior::Never)
        -> behavior::BehaviorActed<Self> {
        match message {}
    }
}
struct Source;
impl behavior_actors::atomic::WorkerSource<(), DeclaredWorker,
    behavior_actors::atomic::ImmediateActivation> for Source
{
    type WorkerRejection = behavior::Never;
    type SourceRejection = behavior::Never;
}
fn requires_declared<Source>()
where
    Source: behavior_actors::atomic::WorkerSource<
        (), OtherWorker, behavior_actors::atomic::ImmediateActivation,
    >,
{}
requires_declared::<Source>();

Required Associated Types§

Source

type WorkerRejection: Send

Exact rejection while preparing one selected role.

Source

type SourceRejection: Send

Exact rejection before the first worker submission is prepared.

Implementations on Foreign Types§

Source§

impl<Role, Worker, Plan> WorkerSource<Role, Worker, Plan> for Never
where Worker: Behavior + Send, Plan: ActivationPlan,

Implementors§