use crate::comp; use serde_derive::{Deserialize, Serialize}; use std::marker::PhantomData; // 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), Actor(comp::Actor), 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), Actor(PhantomData), Player(PhantomData), } } impl sphynx::Packet for EcsPacket { type Phantom = EcsPhantom; }