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
51
52
53
54
55
56
57
58
59
60
61
use Any;
use Deref;
use Bytes;
use ;
use crateTypeMap;
/// Function for encoding a message to bytes.
pub type EncodeMsgFn = fn ;
/// Function for decoding bytes to a message response.
pub type DecodeResFn = fn ;
/// A codec for a specific message type, containing the message id
/// ([`MessageId::ID`][crate::message::MessageId::ID]), an `EncodeMsgFn` for encoding the message
/// to bytes, and a `DecodeResFn` for decoding the message response bytes back to the concrete
/// message response type.
/// A table mapping the [`TypeId`][std::any::TypeId] of messages to their corresponding codecs.
;
/// A codec table for encoding messages and decoding message responses.
///
/// Each entry in the codec table corresponds to a message type the actor can receive from
/// another actor remotely. It records the message id, an `EncodeMsgFn` for encoding the message
/// to bytes before sending, and a `DecodeResFn` for decoding the message response bytes back
/// to the concrete message response type.
///
/// For example, if actor `B` needs to send a message to actor `A` with `A`'s `Address<A>`, `B`
/// needs to use `A`'s codec table. Since a copy of the codec table is stored in `Address<A>`,
/// `B` has access to it automatically if it has `A`'s address.
///
/// # Implementation
///
/// **Do not implement this trait yourself!** Instead, use
/// [`#[derive(RemoteAddressable)]`][acktor_derive::RemoteAddressable], which will emit an
/// implementation of this trait for a remote addressable actor.