forked from mirror/Riven
Convert Queue from enum to newtype_enum
parent
2d80f97170
commit
35f826b198
|
@ -6,17 +6,13 @@
|
|||
// //
|
||||
///////////////////////////////////////////////
|
||||
|
||||
use serde_repr::{ Serialize_repr, Deserialize_repr };
|
||||
use num_enum::{ IntoPrimitive, TryFromPrimitive };
|
||||
use serde::{ Serialize, Deserialize };
|
||||
|
||||
/// League of Legends matchmaking queue.
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
#[derive(Eq, PartialEq)]
|
||||
#[derive(Serialize_repr, Deserialize_repr)]
|
||||
#[derive(IntoPrimitive, TryFromPrimitive)]
|
||||
#[repr(u16)]
|
||||
pub enum Queue {
|
||||
newtype_enum! {
|
||||
/// A League of Legends matchmaking queue.
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[serde(transparent)]
|
||||
pub newtype_enum Queue(u16) {
|
||||
/// Games on Custom games
|
||||
CUSTOM = 0,
|
||||
/// 5v5 Blind Pick games on Summoner's Rift
|
||||
|
@ -247,4 +243,5 @@ pub enum Queue {
|
|||
SUMMONERS_RIFT_TUTORIAL_2 = 2010,
|
||||
/// Tutorial 3 games on Summoner's Rift
|
||||
SUMMONERS_RIFT_TUTORIAL_3 = 2020,
|
||||
}
|
||||
}
|
|
@ -3,17 +3,13 @@
|
|||
const queues = require('./.queues.json');
|
||||
}}{{= dotUtils.preamble() }}
|
||||
|
||||
use serde_repr::{ Serialize_repr, Deserialize_repr };
|
||||
use num_enum::{ IntoPrimitive, TryFromPrimitive };
|
||||
use serde::{ Serialize, Deserialize };
|
||||
|
||||
/// League of Legends matchmaking queue.
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
#[derive(Eq, PartialEq)]
|
||||
#[derive(Serialize_repr, Deserialize_repr)]
|
||||
#[derive(IntoPrimitive, TryFromPrimitive)]
|
||||
#[repr(u16)]
|
||||
pub enum Queue {
|
||||
newtype_enum! {
|
||||
/// A League of Legends matchmaking queue.
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[serde(transparent)]
|
||||
pub newtype_enum Queue(u16) {
|
||||
{{
|
||||
for (const e of queues) {
|
||||
const desc = e['x-desc'] ? e['x-desc'].split('\n') : [];
|
||||
|
@ -29,4 +25,5 @@ pub enum Queue {
|
|||
{{
|
||||
}
|
||||
}}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue