Closed lucasmsoares96 closed 1 year ago
Message
gets automatically derived when deriving RemoteMessage
. See this example: https://github.com/wenig/telepathy-examples/blob/main/paper-example/src/example.rs
Is this connected to #77 ? If so, we can close this issue and your examples should work now. Bear in mind, that you also do not need to specify the rtype for remote messages because they cannot receive a response (with .send()
) so far.
I understood. In case I need a local message with response, do I need to create a different message?
Yes, you need to. Also, I would advise you to because otherwise you have different behavior for the same message. That can become an erroneous spot in your code. You could, as a suggestion, have a wrapper for the local message, which has the remote message as an attribute. That way, you only have to define it once.
#[derive(RemoteMessage, Serialize, Deserialize)]
struct MyMessage {
...
}
#[derive(Message)]
#[rtype(result = "()")]
struct MyLocalMessage(MyMessage)
Something like that!