19 lines
425 B
Rust
19 lines
425 B
Rust
|
use serde::{Deserialize, Serialize};
|
||
|
|
||
|
pub type MessageKind = u32;
|
||
|
|
||
|
pub trait Message: Serialize + for<'de> Deserialize<'de> + Send + Sync {
|
||
|
const KIND: MessageKind;
|
||
|
type Response: Serialize + for<'de> Deserialize<'de> + Send + Sync;
|
||
|
}
|
||
|
|
||
|
#[derive(Serialize, Deserialize)]
|
||
|
pub(crate) struct HelloMessage {
|
||
|
pub server_port: u16,
|
||
|
}
|
||
|
|
||
|
impl Message for HelloMessage {
|
||
|
const KIND: MessageKind = 0x42000001;
|
||
|
type Response = ();
|
||
|
}
|