aboutsummaryrefslogtreecommitdiff
path: root/src/gamedata.rs
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2020-09-28 13:57:37 +0200
committerDaniel Schadt <kingdread@gmx.de>2020-09-28 13:57:37 +0200
commit9f73455cc21f5991dcb2844c369bb4ca7df64747 (patch)
tree4041707fe6fdcc6899e228e0c54b1dff3bfa53d9 /src/gamedata.rs
parent52deb7c4a8ed0a3714abe10c6d532e34f784f86c (diff)
downloadevtclib-9f73455cc21f5991dcb2844c369bb4ca7df64747.tar.gz
evtclib-9f73455cc21f5991dcb2844c369bb4ca7df64747.tar.bz2
evtclib-9f73455cc21f5991dcb2844c369bb4ca7df64747.zip
optionally implement serde::{Des,S}erialize
Diffstat (limited to 'src/gamedata.rs')
-rw-r--r--src/gamedata.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gamedata.rs b/src/gamedata.rs
index 8d0bb7f..64b6731 100644
--- a/src/gamedata.rs
+++ b/src/gamedata.rs
@@ -15,6 +15,7 @@ use thiserror::Error;
///
/// This enum is non-exhaustive to ensure that future encounters can be added without
/// inducing a breaking change.
+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, FromPrimitive)]
#[non_exhaustive]
#[repr(u16)]
@@ -193,6 +194,7 @@ impl Display for Encounter {
///
/// This enum is non-exhaustive to ensure that future bosses can be added without
/// inducing a breaking change.
+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, FromPrimitive)]
#[non_exhaustive]
#[repr(u16)]
@@ -516,6 +518,7 @@ pub struct ParseProfessionError(String);
///
/// This only contains the 9 base professions. For elite specializations, see
/// [`EliteSpec`][EliteSpec].
+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, FromPrimitive)]
pub enum Profession {
Guardian = 1,
@@ -576,6 +579,7 @@ pub struct ParseEliteSpecError(String);
/// Note that the numeric value of the enum variants correspond to the specialization ID in the API
/// as well. See [the official wiki](https://wiki.guildwars2.com/wiki/API:2/specializations) for
/// more information regarding the API usage.
+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, FromPrimitive)]
pub enum EliteSpec {
// Heart of Thorns elites: