mirror of
https://github.com/MingweiSamuel/Riven.git
synced 2025-01-14 04:47:28 -08:00
Convert Queue from enum to newtype_enum
This commit is contained in:
parent
2d80f97170
commit
35f826b198
2 changed files with 250 additions and 256 deletions
|
@ -6,17 +6,13 @@
|
||||||
// //
|
// //
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
|
|
||||||
use serde_repr::{ Serialize_repr, Deserialize_repr };
|
use serde::{ Serialize, Deserialize };
|
||||||
use num_enum::{ IntoPrimitive, TryFromPrimitive };
|
|
||||||
|
|
||||||
/// League of Legends matchmaking queue.
|
newtype_enum! {
|
||||||
#[non_exhaustive]
|
/// A League of Legends matchmaking queue.
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Serialize, Deserialize)]
|
||||||
#[derive(Eq, PartialEq)]
|
#[serde(transparent)]
|
||||||
#[derive(Serialize_repr, Deserialize_repr)]
|
pub newtype_enum Queue(u16) {
|
||||||
#[derive(IntoPrimitive, TryFromPrimitive)]
|
|
||||||
#[repr(u16)]
|
|
||||||
pub enum Queue {
|
|
||||||
/// Games on Custom games
|
/// Games on Custom games
|
||||||
CUSTOM = 0,
|
CUSTOM = 0,
|
||||||
/// 5v5 Blind Pick games on Summoner's Rift
|
/// 5v5 Blind Pick games on Summoner's Rift
|
||||||
|
@ -247,4 +243,5 @@ pub enum Queue {
|
||||||
SUMMONERS_RIFT_TUTORIAL_2 = 2010,
|
SUMMONERS_RIFT_TUTORIAL_2 = 2010,
|
||||||
/// Tutorial 3 games on Summoner's Rift
|
/// Tutorial 3 games on Summoner's Rift
|
||||||
SUMMONERS_RIFT_TUTORIAL_3 = 2020,
|
SUMMONERS_RIFT_TUTORIAL_3 = 2020,
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -3,17 +3,13 @@
|
||||||
const queues = require('./.queues.json');
|
const queues = require('./.queues.json');
|
||||||
}}{{= dotUtils.preamble() }}
|
}}{{= dotUtils.preamble() }}
|
||||||
|
|
||||||
use serde_repr::{ Serialize_repr, Deserialize_repr };
|
use serde::{ Serialize, Deserialize };
|
||||||
use num_enum::{ IntoPrimitive, TryFromPrimitive };
|
|
||||||
|
|
||||||
/// League of Legends matchmaking queue.
|
newtype_enum! {
|
||||||
#[non_exhaustive]
|
/// A League of Legends matchmaking queue.
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Serialize, Deserialize)]
|
||||||
#[derive(Eq, PartialEq)]
|
#[serde(transparent)]
|
||||||
#[derive(Serialize_repr, Deserialize_repr)]
|
pub newtype_enum Queue(u16) {
|
||||||
#[derive(IntoPrimitive, TryFromPrimitive)]
|
|
||||||
#[repr(u16)]
|
|
||||||
pub enum Queue {
|
|
||||||
{{
|
{{
|
||||||
for (const e of queues) {
|
for (const e of queues) {
|
||||||
const desc = e['x-desc'] ? e['x-desc'].split('\n') : [];
|
const desc = e['x-desc'] ? e['x-desc'].split('\n') : [];
|
||||||
|
@ -29,4 +25,5 @@ pub enum Queue {
|
||||||
{{
|
{{
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue