use std::marker::PhantomData; use serde_derive::{Serialize, Deserialize}; use crate::comp; // Automatically derive From for Packet for each variant Packet::T(T) sphynx::sum_type! { #[derive(Clone, Debug, Serialize, Deserialize)] pub enum EcsPacket { Pos(comp::phys::Pos), Vel(comp::phys::Vel), Dir(comp::phys::Dir), Character(comp::Character), Player(comp::Player), } } // Automatically derive From for Phantom for each variant Phantom::T(PhantomData) sphynx::sum_type! { #[derive(Clone, Debug, Serialize, Deserialize)] pub enum EcsPhantom { Pos(PhantomData), Vel(PhantomData), Dir(PhantomData), Character(PhantomData), Player(PhantomData), } } impl sphynx::Packet for EcsPacket { type Phantom = EcsPhantom; }