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§
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>>
fn try_into_any_payload<I: Message>(self) -> Result<Payload<I>, Self>
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".