Expand description
Indicates that a certain type can be sent as an actor message.
-
Must be
UnwindSafe
because messages should not hold shared mutable data or references. If you cheat on this your warranty is void. You shouldn’t include Atomics or Mutexes/RwLocks either, even though these implementUnwindSafe
. Mailboxes must be able to recover from panics inside theHandler::handle
method. The trait bound has been removed because it is very inconsistently implemented troughout the ecosystem which means one would have to wrap every message inAssertUnwindSafe
. This fails the goal of actually detecting where a problem might be present, making the trait more or less useless. Also it is more a requirement of the implementation than of the interface, as some implementations might chose not to recover from panics. In that case there is no risk. thespis_impl in any case wraps your handlers inAssertUnwindSafe
in order to recover and allow actor supervision. So if you use that, be sure to respect the directions given above. -
Must be ’static because Messages should not hold references.
-
Must be Send because limitations in the Rust type system mean we would have to double out the entire interface to support
Send
vs notSend
messages.
Required Associated Types
The type of response returned when using Address::call. When the message is sent through Address::send, no value will be returned.
If you don’t need a return value but you want to guarantee that the message has
been processed you can specify ()
here and use Address::call.
This should also be UnwindSafe
.