1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
//! Models shared for usage by more than one endpoint. Note that, if all the relevant endpoints' //! features are disabled, then the respective models here are also disabled. use serde::{self, Serialize, Deserialize}; /// A struct representing a brawler's star power. Note that, if **both** `players` and `brawlers` /// features are turned off, then this struct is also removed (it is required by both, so if neither /// are enabled anymore, this isn't either). #[derive(Debug, Clone, Hash, PartialEq, Eq, Serialize, Deserialize)] #[cfg(any(feature = "players", feature = "brawlers"))] pub struct StarPower { /// The star power name. #[serde(default)] pub name: String, /// The star power's id (an arbitrary number). #[serde(default)] pub id: usize } impl Default for StarPower { /// Returns an instance of `StarPower` with initial values. /// /// # Examples /// /// ```rust /// use brawl_api::StarPower; /// /// assert_eq!( /// StarPower::default(), /// StarPower { /// name: String::from(""), /// id: 0, /// } /// ); /// ``` fn default() -> StarPower { StarPower { name: String::from(""), id: 0 } } }