diff options
author | Daniel Schadt <kingdread@gmx.de> | 2019-12-06 18:00:04 +0100 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2019-12-06 18:00:04 +0100 |
commit | d35534c0795caeda46e57fc515b74eba701110a2 (patch) | |
tree | 61036c13c2ce1b7caaf372043471bab4d0f4acd7 /src/api/traits.rs | |
download | kondou-d35534c0795caeda46e57fc515b74eba701110a2.tar.gz kondou-d35534c0795caeda46e57fc515b74eba701110a2.tar.bz2 kondou-d35534c0795caeda46e57fc515b74eba701110a2.zip |
initial commit
Diffstat (limited to 'src/api/traits.rs')
-rw-r--r-- | src/api/traits.rs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/api/traits.rs b/src/api/traits.rs new file mode 100644 index 0000000..194d061 --- /dev/null +++ b/src/api/traits.rs @@ -0,0 +1,40 @@ +//! Struct definitions for the traits API endpoint. +//! +//! * [Example](https://api.guildwars2.com/v2/traits/214) +//! * [Wiki](https://wiki.guildwars2.com/wiki/API:2/traits) + +use super::HasId; +use serde::{Deserialize, Serialize}; + +#[derive(Deserialize, Serialize, Debug, Clone)] +pub struct Trait { + /// The trait id. + pub id: u32, + /// The trait name. + pub name: String, + /// The trait's icon URL. + pub icon: String, + /// The trait description. + pub description: String, + /// The id of the specialization this trait belongs to. + pub specialization: u32, + /// The trait's tier, as a value from 1-3. + /// + /// Elite specializations also contain a tier 0 minor trait, describing which weapon the elite + /// specialization gains access to. + pub tier: u32, + pub slot: Slot, +} + +impl HasId for Trait { + type Id = u32; + fn get_id(&self) -> u32 { + self.id + } +} + +#[derive(Deserialize, Serialize, Debug, PartialEq, Eq, Hash, Copy, Clone)] +pub enum Slot { + Major, + Minor, +} |