Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pub const PacketType = packed enum {
- AuthTokenPacket,
- AuthSucceededPacket,
- AuthFailedPacket,
- };
- pub fn Packet(comptime T: type) type {
- return packed struct {
- pub const data_size = @sizeOf(T);
- type: PacketType,
- data: T,
- pub fn init(self: *@This(), packet: T) void {
- self.type = T.packetType();
- self.data = packet;
- }
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement