1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
use ;
use crateAddress;
use crateCodec;
use crate;
use crateStableId;
/// An actor which can be reached from other processes.
///
/// To make an actor reachable, the user should implement [`Codec`] trait and
/// [`Handler<BinaryMessage>`] trait for it.
///
/// The [`Codec`] trait provides a [`CodecTable`][crate::codec::CodecTable], which is mandatory
/// when sending messages to a remote addressable actor from other processes. Each message type
/// that can be handled by the actor should have a corresponding entry in the table, which
/// describes how to encode the message and decode the message response. A copy of this table is
/// stored in the [`Address`][crate::address::Address] of a remote addressable actor. See
/// [`Address`][crate::address::Address] for more details on how the table is used to encode
/// messages.
///
/// The [`Handler<BinaryMessage>`] trait defines how a remote addressable actor handles inbound
/// binary messages received from other processes. The actor should decode the byte array in the
/// binary message to a concrete message type, handle it with the corresponding handler, and
/// encode the message response (if any) to bytes and send it back to the sender.
///
/// # Implementation
///
/// **Do not implement this trait yourself!** Instead, use
/// [`#[derive(RemoteAddressable)]`][acktor_derive::RemoteAddressable] together with the
/// [`#[remote]`][acktor_derive::remote] attribute macro.
///
/// [`#[derive(RemoteAddressable)]`][acktor_derive::RemoteAddressable] will
/// emit implementations for both required supertraits as well as the `RemoteAddressable` trait
/// itself.
///
/// The [`#[remote]`][acktor_derive::remote] attribute macro is used to annotate the
/// `impl Actor for MyActor` block to override the `remote_mailbox` method. This internal method
/// is used to return a [`RemoteMailbox`][crate::address::RemoteMailbox] for a remote addressable
/// actor. It is a temporary workaround since specialization is not yet stable in Rust.
/// An actor type which can be created from another process.