feat: add serde support
This commit is contained in:
parent
aafd83a1cb
commit
8e5f77b98f
|
@ -21,6 +21,8 @@ roles = []
|
|||
# World-related
|
||||
data_centers = []
|
||||
worlds = []
|
||||
|
||||
with_serde = ["serde", "serde_derive"]
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "1", optional = true }
|
||||
serde_derive = { version = "1", optional = true }
|
||||
|
|
|
@ -6,6 +6,7 @@ use std::fmt::{Display, Formatter, Result as FmtResult};
|
|||
use std::str::FromStr;
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[cfg_attr(feature = "with_serde", derive(Serialize, Deserialize))]
|
||||
pub enum DataCenter {
|
||||
Aether,
|
||||
Chaos,
|
||||
|
|
|
@ -12,6 +12,7 @@ use std::str::FromStr;
|
|||
/// [`Job`]: ::jobs::Job
|
||||
/// [`NonCombatJob`]: ::jobs::NonCombatJob
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[cfg_attr(feature = "with_serde", derive(Serialize, Deserialize))]
|
||||
pub enum Classification {
|
||||
War,
|
||||
Magic,
|
||||
|
|
|
@ -11,6 +11,7 @@ use std::str::FromStr;
|
|||
|
||||
/// The Disciple of War and Disciple of Magic jobs available in the game.
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[cfg_attr(feature = "with_serde", derive(Serialize, Deserialize))]
|
||||
pub enum Job {
|
||||
// DPS
|
||||
Bard,
|
||||
|
|
|
@ -9,6 +9,7 @@ use std::str::FromStr;
|
|||
|
||||
/// The Disciple of the Land and Disciple of the Hand jobs available in the game.
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[cfg_attr(feature = "with_serde", derive(Serialize, Deserialize))]
|
||||
pub enum NonCombatJob {
|
||||
// Gatherers
|
||||
Botanist,
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
//! Types for use in FFXIV-related projects.
|
||||
|
||||
#[cfg(feature = "with_serde")]
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
|
||||
#[cfg(feature = "data_centers")]
|
||||
pub mod data_centers;
|
||||
pub mod errors;
|
||||
|
|
|
@ -11,6 +11,7 @@ use std::str::FromStr;
|
|||
///
|
||||
/// [`Job`]: ::jobs::Job
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[cfg_attr(feature = "with_serde", derive(Serialize, Deserialize))]
|
||||
pub enum Role {
|
||||
Dps,
|
||||
Healer,
|
||||
|
|
|
@ -11,6 +11,7 @@ use std::str::FromStr;
|
|||
///
|
||||
/// Each [`DataCenter`] has multiple worlds attached to it.
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[cfg_attr(feature = "with_serde", derive(Serialize, Deserialize))]
|
||||
pub enum World {
|
||||
// Aether
|
||||
Adamantoise,
|
||||
|
|
Loading…
Reference in New Issue