Trait interlink::msg::Message

source ·
pub trait Message: Send + 'static {
    type Response: Send + 'static;
}
Expand description

Message type implemented by structures that can be passed around as messages through envelopes.

This trait can be derived using its derive macro

use interlink::prelude::*;

#[derive(Message)]
struct MyMessage {
    value: String,
}

Without specifying the response type in the above message it will default to the () unit response type. To specify the response type you can use the syntax below

use interlink::prelude::*;

#[derive(Message)]
#[msg(rtype = "String")]
struct MyMessage {
    value: String,
}

Required Associated Types§

source

type Response: Send + 'static

The type of the response that handlers will produce when handling this message

Implementors§