mtg_data/
ability_word.rs

1#[derive(idris_derive::Idris)]
2#[idris(repr = usize)]
3#[derive(serde::Serialize, serde::Deserialize)]
4#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
5#[cfg_attr(feature = "ts_export", derive(ts_rs::TS))]
6pub enum AbilityWord {
7    Adamant,
8    Addendum,
9    Alliance,
10    Battalion,
11    Bloodrush,
12    Celebration,
13    Channel,
14    Chroma,
15    Cohort,
16    Constellation,
17    Converge,
18    Corrupted,
19    CouncilsDilemma,
20    Coven,
21    Delirium,
22    Descend,
23    Domain,
24    Eerie,
25    Eminence,
26    Enrage,
27    FatefulHour,
28    FathomlessDescent,
29    Ferocious,
30    Flurry,
31    Formidable,
32    Grandeur,
33    Hellbent,
34    HerosReward,
35    Heroic,
36    Imprint,
37    Inspired,
38    JoinForces,
39    Kinfall,
40    Kinship,
41    Landfall,
42    Landship,
43    Legacy,
44    Lieutenant,
45    Magecraft,
46    Metalcraft,
47    Morbid,
48    PackTactics,
49    Paradox,
50    Parley,
51    Radiance,
52    Raid,
53    Rally,
54    Renew,
55    Revolt,
56    SecretCouncil,
57    SpellMastery,
58    StartYourEngines,
59    Strive,
60    Survival,
61    Sweep,
62    Teamwork,
63    TemptingOffer,
64    Threshold,
65    Underdog,
66    Undergrowth,
67    Valiant,
68    Void,
69    WillOfThePlaneswalkers,
70    WillOfTheCouncil,
71}
72
73impl std::str::FromStr for AbilityWord {
74    type Err = crate::ParsingError;
75    fn from_str(s: &str) -> Result<Self, Self::Err> {
76        match s {
77            "adamant" => Ok(Self::Adamant),
78            "addendum" => Ok(Self::Addendum),
79            "alliance" => Ok(Self::Alliance),
80            "battalion" => Ok(Self::Battalion),
81            "bloodrush" => Ok(Self::Bloodrush),
82            "celebration" => Ok(Self::Celebration),
83            "channel" => Ok(Self::Channel),
84            "chroma" => Ok(Self::Chroma),
85            "cohort" => Ok(Self::Cohort),
86            "constellation" => Ok(Self::Constellation),
87            "converge" => Ok(Self::Converge),
88            "corrupted" => Ok(Self::Corrupted),
89            "council's dilemma" => Ok(Self::CouncilsDilemma),
90            "coven" => Ok(Self::Coven),
91            "delirium" => Ok(Self::Delirium),
92            "descend" => Ok(Self::Descend),
93            "domain" => Ok(Self::Domain),
94            "eerie" => Ok(Self::Eerie),
95            "eminence" => Ok(Self::Eminence),
96            "enrage" => Ok(Self::Enrage),
97            "fateful hour" => Ok(Self::FatefulHour),
98            "fathomless descent" => Ok(Self::FathomlessDescent),
99            "ferocious" => Ok(Self::Ferocious),
100            "flurry" => Ok(Self::Flurry),
101            "formidable" => Ok(Self::Formidable),
102            "grandeur" => Ok(Self::Grandeur),
103            "hellbent" => Ok(Self::Hellbent),
104            "hero's reward" => Ok(Self::HerosReward),
105            "heroic" => Ok(Self::Heroic),
106            "imprint" => Ok(Self::Imprint),
107            "inspired" => Ok(Self::Inspired),
108            "join forces" => Ok(Self::JoinForces),
109            "kinfall" => Ok(Self::Kinfall),
110            "kinship" => Ok(Self::Kinship),
111            "landfall" => Ok(Self::Landfall),
112            "landship" => Ok(Self::Landship),
113            "legacy" => Ok(Self::Legacy),
114            "lieutenant" => Ok(Self::Lieutenant),
115            "magecraft" => Ok(Self::Magecraft),
116            "metalcraft" => Ok(Self::Metalcraft),
117            "morbid" => Ok(Self::Morbid),
118            "pack tactics" => Ok(Self::PackTactics),
119            "paradox" => Ok(Self::Paradox),
120            "parley" => Ok(Self::Parley),
121            "radiance" => Ok(Self::Radiance),
122            "raid" => Ok(Self::Raid),
123            "rally" => Ok(Self::Rally),
124            "renew" => Ok(Self::Renew),
125            "revolt" => Ok(Self::Revolt),
126            "secret council" => Ok(Self::SecretCouncil),
127            "spell mastery" => Ok(Self::SpellMastery),
128            "start your engines!" => Ok(Self::StartYourEngines),
129            "strive" => Ok(Self::Strive),
130            "survival" => Ok(Self::Survival),
131            "sweep" => Ok(Self::Sweep),
132            "teamwork" => Ok(Self::Teamwork),
133            "tempting offer" => Ok(Self::TemptingOffer),
134            "threshold" => Ok(Self::Threshold),
135            "underdog" => Ok(Self::Underdog),
136            "undergrowth" => Ok(Self::Undergrowth),
137            "valiant" => Ok(Self::Valiant),
138            "void" => Ok(Self::Void),
139            "will of the planeswalkers" => Ok(Self::WillOfThePlaneswalkers),
140            "will of the council" => Ok(Self::WillOfTheCouncil),
141            _ => Err(crate::ParsingError {
142                item: "AbilityWord",
143                message: "provided source does not match",
144            }),
145        }
146    }
147}
148
149impl AbilityWord {
150    pub fn as_str(&self) -> &'static str {
151        match self {
152            Self::Adamant => "adamant",
153            Self::Addendum => "addendum",
154            Self::Alliance => "alliance",
155            Self::Battalion => "battalion",
156            Self::Bloodrush => "bloodrush",
157            Self::Celebration => "celebration",
158            Self::Channel => "channel",
159            Self::Chroma => "chroma",
160            Self::Cohort => "cohort",
161            Self::Constellation => "constellation",
162            Self::Converge => "converge",
163            Self::Corrupted => "corrupted",
164            Self::CouncilsDilemma => "council's dilemma",
165            Self::Coven => "coven",
166            Self::Delirium => "delirium",
167            Self::Descend => "descend",
168            Self::Domain => "domain",
169            Self::Eerie => "eerie",
170            Self::Eminence => "eminence",
171            Self::Enrage => "enrage",
172            Self::FatefulHour => "fateful hour",
173            Self::FathomlessDescent => "fathomless descent",
174            Self::Ferocious => "ferocious",
175            Self::Flurry => "flurry",
176            Self::Formidable => "formidable",
177            Self::Grandeur => "grandeur",
178            Self::Hellbent => "hellbent",
179            Self::HerosReward => "hero's reward",
180            Self::Heroic => "heroic",
181            Self::Imprint => "imprint",
182            Self::Inspired => "inspired",
183            Self::JoinForces => "join forces",
184            Self::Kinfall => "kinfall",
185            Self::Kinship => "kinship",
186            Self::Landfall => "landfall",
187            Self::Landship => "landship",
188            Self::Legacy => "legacy",
189            Self::Lieutenant => "lieutenant",
190            Self::Magecraft => "magecraft",
191            Self::Metalcraft => "metalcraft",
192            Self::Morbid => "morbid",
193            Self::PackTactics => "pack tactics",
194            Self::Paradox => "paradox",
195            Self::Parley => "parley",
196            Self::Radiance => "radiance",
197            Self::Raid => "raid",
198            Self::Rally => "rally",
199            Self::Renew => "renew",
200            Self::Revolt => "revolt",
201            Self::SecretCouncil => "secret council",
202            Self::SpellMastery => "spell mastery",
203            Self::StartYourEngines => "start your engines!",
204            Self::Strive => "strive",
205            Self::Survival => "survival",
206            Self::Sweep => "sweep",
207            Self::Teamwork => "teamwork",
208            Self::TemptingOffer => "tempting offer",
209            Self::Threshold => "threshold",
210            Self::Underdog => "underdog",
211            Self::Undergrowth => "undergrowth",
212            Self::Valiant => "valiant",
213            Self::Void => "void",
214            Self::WillOfThePlaneswalkers => "will of the planeswalkers",
215            Self::WillOfTheCouncil => "will of the council",
216        }
217    }
218}
219
220impl std::fmt::Display for AbilityWord {
221    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
222        write!(f, "{}", self.as_str())
223    }
224}
225
226impl AbilityWord {
227    pub fn all() -> impl Iterator<Item = Self> {
228        [
229            Self::Adamant,
230            Self::Addendum,
231            Self::Alliance,
232            Self::Battalion,
233            Self::Bloodrush,
234            Self::Celebration,
235            Self::Channel,
236            Self::Chroma,
237            Self::Cohort,
238            Self::Constellation,
239            Self::Converge,
240            Self::Corrupted,
241            Self::CouncilsDilemma,
242            Self::Coven,
243            Self::Delirium,
244            Self::Descend,
245            Self::Domain,
246            Self::Eerie,
247            Self::Eminence,
248            Self::Enrage,
249            Self::FatefulHour,
250            Self::FathomlessDescent,
251            Self::Ferocious,
252            Self::Flurry,
253            Self::Formidable,
254            Self::Grandeur,
255            Self::Hellbent,
256            Self::HerosReward,
257            Self::Heroic,
258            Self::Imprint,
259            Self::Inspired,
260            Self::JoinForces,
261            Self::Kinfall,
262            Self::Kinship,
263            Self::Landfall,
264            Self::Landship,
265            Self::Legacy,
266            Self::Lieutenant,
267            Self::Magecraft,
268            Self::Metalcraft,
269            Self::Morbid,
270            Self::PackTactics,
271            Self::Paradox,
272            Self::Parley,
273            Self::Radiance,
274            Self::Raid,
275            Self::Rally,
276            Self::Renew,
277            Self::Revolt,
278            Self::SecretCouncil,
279            Self::SpellMastery,
280            Self::StartYourEngines,
281            Self::Strive,
282            Self::Survival,
283            Self::Sweep,
284            Self::Teamwork,
285            Self::TemptingOffer,
286            Self::Threshold,
287            Self::Underdog,
288            Self::Undergrowth,
289            Self::Valiant,
290            Self::Void,
291            Self::WillOfThePlaneswalkers,
292            Self::WillOfTheCouncil,
293        ].into_iter()
294    }
295}