Skip to main content

DeliveryRoute

Trait DeliveryRoute 

Source
pub trait DeliveryRoute: DeliveryRoute + Sized {
    type Protocol: Protocol;
    type Sends: SendEffects;

    // Required method
    fn deliver(self, message: <Self::Protocol as Protocol>::Msg) -> Self::Sends;
}
Expand description

A statically selected transferable destination capability.

The associated protocol prevents actor templates from repeating a separate protocol parameter beside the route that already determines it. Logical and established routes select different concrete send products without weakening either capability.

The owner’s address namespace is stated through the associated protocol: R: DeliveryRoute<Protocol: Protocol<Addr = BehaviorAddr<Owner>>>. A route for another protocol cannot be substituted merely because its payload has the same Rust type:

ⓘ
type Expected = behavior::MessageProtocol<behavior::MailAddr, u8>;
struct Other;
impl behavior::Protocol for Other {
    type Addr = behavior::MailAddr;
    type Msg = u8;
}
fn require_expected<R: behavior_actors::DeliveryRoute<Protocol = Expected>>(_: R) {}
require_expected(behavior::Recipient::<Other>::global(behavior::MailAddr(1)));

Creator-local child routes require the owning actor’s birth algebra and cannot be substituted for a transferable acquaintance. There is one route interface for these transferable capabilities:

ⓘ
fn require<Owner, Route>()
where
    Owner: behavior::Behavior,
    Route: behavior_actors::DeliveryRouteFor<Owner>,
{}

Required Associated Types§

Source

type Protocol: Protocol

Protocol selected by this capability.

Source

type Sends: SendEffects

The concrete sends product produced by this route.

Required Methods§

Source

fn deliver(self, message: <Self::Protocol as Protocol>::Msg) -> Self::Sends

Consume the capability into one explicit ordered delivery product.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<P> DeliveryRoute for EstablishedRecipient<P>

Source§

type Protocol = P

Source§

type Sends = Vec<EstablishedDelivery<P>>

Source§

fn deliver(self, message: P::Msg) -> Self::Sends

Source§

impl<P: Protocol> DeliveryRoute for Recipient<P>

Source§

type Protocol = P

Source§

type Sends = Vec<Delivery<P>>

Source§

fn deliver(self, message: P::Msg) -> Self::Sends

Implementors§