20 lines
394 B
Rust
20 lines
394 B
Rust
use num_enum::{IntoPrimitive, TryFromPrimitive};
|
|
use protocol_derive::{Encode, Decode};
|
|
|
|
#[derive(Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
|
|
#[repr(u16)]
|
|
pub enum PacketKind {
|
|
HandshakeRequest,
|
|
HandshakeAccept,
|
|
HandshakeFinal,
|
|
Ping,
|
|
Pong,
|
|
Message,
|
|
}
|
|
|
|
#[derive(Debug, Decode, Encode)]
|
|
pub struct Message {
|
|
pub sender: String,
|
|
pub contents: String,
|
|
}
|