netapp/src/message.rs

19 lines
425 B
Rust
Raw Normal View History

2020-12-02 12:30:47 +00:00
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 = ();
}