[Crate] Add feature: serde (#21)

* feat(serde): add additional derives

* fix: remove attr on internal enum

* fix add missing derive
This commit is contained in:
Cain 2023-03-13 15:51:33 +01:00 committed by GitHub
parent bd2e373d66
commit 84af4230f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 113 additions and 62 deletions

View file

@ -3,7 +3,11 @@ use crate::GDResult;
use crate::protocols::valve;
use crate::protocols::valve::{Server, ServerPlayer, get_optional_extracted_data, SteamApp};
#[derive(Debug)]
#[cfg (feature = "serde")]
use serde::{Serialize, Deserialize};
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, Clone, PartialEq, PartialOrd)]
pub struct TheShipPlayer {
pub name: String,
pub score: u32,
@ -24,7 +28,8 @@ impl TheShipPlayer {
}
}
#[derive(Debug)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, Clone, PartialEq)]
pub struct Response {
pub protocol: u8,
pub name: String,