Expand description
Procedure macro for Message formatting in ractor_cluster. This implements
the ractor::Message trait for non-serializable and serializable messages automatically.
note: rampant use of cargo expand was used in the making of this macro. E.g.
cargo expand -p ractor_playground 2>&1 > expand.tmp.rsCaveats:
- Non-serializable macros are simply getting
impl ractor::Message for MyStructOrEnumadded onto their struct - Serializable messages have to have a few formatting requirements.
a. All variants of the enum will be numbered based on their lexicographical ordering, which is sent over-the-wire in order to decode which
variant was called. This is the
indexfield on any variant ofractor::message::SerializedMessageb. All properties of the message MUST implement theractor::BytesConvertabletrait which means they supply ato_bytesandfrom_bytesmethod. Many types are pre-done for you inractor’s definition of the trait c. For RPCs, the LAST argument must be the reply channel. Additionally the type of message the channel is expecting back must also implementractor::BytesConvertabled. Lastly, for RPCs, they should additionally be decorated with#[rpc]on each variant’s definition. This helps the macro identify that it is an RPC and will need port handler
Derive Macros§
- Ractor
Cluster Message - Derive
ractor::Messagefor messages that can be sent over the network - Ractor
Message - Derive
ractor::Messagefor messages that are local-only