adding game_type, removing unneccesary std::fmt::Debug imports

This commit is contained in:
Mingwei Samuel 2019-10-25 19:38:08 -07:00
parent 561eb04c48
commit adec5f0df8
9 changed files with 53 additions and 9 deletions

View file

@ -8,7 +8,7 @@ use num_derive;
///
/// The documentation of each variant specifies:<br>
/// NAME (`IDENTIFIER`, ID).
#[derive(fmt::Debug, Copy, Clone)]
#[derive(Debug, Copy, Clone)]
#[derive(num_derive::FromPrimitive, num_derive::ToPrimitive)]
pub enum Champion {
/** Aatrox (`Aatrox`, 266). */ Aatrox = 266,

View file

@ -1,7 +1,5 @@
#![allow(deprecated)]
use std::fmt::Debug;
use strum_macros::{ EnumString, Display, AsRefStr };
#[derive(Debug, Copy, Clone)]
@ -13,7 +11,6 @@ pub enum Division {
II = 2,
III = 3,
IV = 4,
#[deprecated(note="Removed for 2019.")]
V = 5,
}

21
src/consts/game_type.rs Normal file
View file

@ -0,0 +1,21 @@
// This file is automatically generated.
// Do not directly edit.
use strum_macros::{ EnumString, Display, AsRefStr };
/// League of Legends game type: matched game, custom game, or tutorial game.
#[derive(Debug, Copy, Clone)]
#[derive(Eq, PartialEq, Hash)]
#[derive(EnumString, Display, AsRefStr)]
#[repr(u8)]
pub enum GameType {
/// Custom games
#[strum(to_string="CUSTOM_GAME")]
CustomGame,
/// Tutorial games
#[strum(to_string="TUTORIAL_GAME")]
TutorialGame,
/// all other games
#[strum(to_string="MATCHED_GAME")]
MatchedGame,
}

View file

@ -6,6 +6,9 @@ pub use champion::*;
mod division;
pub use division::*;
mod game_type;
pub use game_type::*;
mod queue_type;
pub use queue_type::*;

View file

@ -1,5 +1,3 @@
use std::fmt::Debug;
use strum_macros::{ EnumString, Display, AsRefStr };
#[derive(Debug, Copy, Clone)]

View file

@ -1,7 +1,5 @@
#![allow(deprecated)]
use std::fmt::Debug;
use strum_macros::{ EnumString, Display, AsRefStr };
#[derive(Debug, Copy, Clone)]

View file

@ -20,7 +20,7 @@ use num_derive;
///
/// The documentation of each variant specifies:<br>
/// NAME (`IDENTIFIER`, ID).
#[derive(fmt::Debug, Copy, Clone)]
#[derive(Debug, Copy, Clone)]
#[derive(num_derive::FromPrimitive, num_derive::ToPrimitive)]
pub enum Champion {
{{

View file

@ -0,0 +1,23 @@
{{
const dotUtils = require('./dotUtils.js');
const gameTypes = require('./.gameTypes.json');
}}{{= dotUtils.preamble() }}
use strum_macros::{ EnumString, Display, AsRefStr };
/// League of Legends game type: matched game, custom game, or tutorial game.
#[derive(Debug, Copy, Clone)]
#[derive(Eq, PartialEq, Hash)]
#[derive(EnumString, Display, AsRefStr)]
#[repr(u8)]
pub enum GameType {
{{
for (const { gametype: gameType, description } of gameTypes) {
}}
/// {{= description }}
#[strum(to_string="{{= gameType }}")]
{{= dotUtils.changeCase.pascalCase(gameType) }},
{{
}
}}
}

View file

@ -22,6 +22,10 @@ const files = [
[
'http://static.developer.riotgames.com/docs/lol/queues.json',
'.queues.json'
],
[
'http://static.developer.riotgames.com/docs/lol/gameTypes.json',
'.gameTypes.json'
]
]