protocol: Implement PacketType for Packet.
This commit is contained in:
parent
dfbfeddfdf
commit
9fca0221db
|
@ -90,6 +90,32 @@ macro_rules! state_packets {
|
|||
)+
|
||||
}
|
||||
|
||||
impl PacketType for Packet {
|
||||
fn packet_id(&self, version: i32) -> i32 {
|
||||
match self {
|
||||
$(
|
||||
$(
|
||||
$(
|
||||
Self::$name(p) => p.packet_id(version),
|
||||
)*
|
||||
)+
|
||||
)+
|
||||
}
|
||||
}
|
||||
|
||||
fn write<W: io::Write>(&self, buf: &mut W) -> Result<(), Error> {
|
||||
match self {
|
||||
$(
|
||||
$(
|
||||
$(
|
||||
Self::$name(p) => p.write(buf),
|
||||
)*
|
||||
)+
|
||||
)+
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$(
|
||||
pub mod $state {
|
||||
|
||||
|
|
Loading…
Reference in New Issue