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