Skip to main content

Interface

Trait Interface 

Source
pub trait Interface:
    Message<Kind = FireAndForget>
    + TryIntoPayload<Self>
    + FromPayload<Self>
    + AsSet
    + Sized
    + Send
    + 'static {
    // Required methods
    fn try_from_boxed_payload(
        payload: BoxedPayload,
    ) -> Result<Self, BoxedPayload>;
    fn into_boxed_payload(self) -> BoxedPayload;

    // Provided methods
    fn try_from_any_payload<I: Message>(
        payload: Payload<I>,
    ) -> Result<Self, Payload<I>>
       where Payload<I>: Send { ... }
    fn try_into_any_payload<I: Message>(self) -> Result<Payload<I>, Self> { ... }
    fn invocable_with(type_id: TypeId) -> bool { ... }
}
Expand description

An interface defines the set of messages that can be sent to a given actor. This is usually derived on an enum using the #[derive(Interface)] macro.

It defines conversion methods to and from a boxed payload, which is used for dynamic dispatch of messages.

Required Methods§

Provided Methods§

Source

fn try_from_any_payload<I: Message>( payload: Payload<I>, ) -> Result<Self, Payload<I>>
where Payload<I>: Send,

Source

fn try_into_any_payload<I: Message>(self) -> Result<Payload<I>, Self>

Source

fn invocable_with(type_id: TypeId) -> bool

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§