1use crate::Key;
5
6#[non_exhaustive]
10#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
11pub enum DocSection {
12 QuickStart,
14 Format,
16 StrictAndLenientParsing,
18 Matching,
20 Folding,
22 Keys,
24 BuiltInRules,
26 Recipes,
28 LauncherResponsibilities,
30}
31
32macro_rules! section {
34 ($anchor:literal) => {
35 concat!(docs_url!(), "#", $anchor)
36 };
37}
38
39macro_rules! variant {
41 ($variant:ident) => {
42 concat!(docs_url!(), "enum.Key.html#variant.", stringify!($variant))
43 };
44}
45
46impl DocSection {
47 pub const ALL: &'static [Self] = &[
49 Self::QuickStart,
50 Self::Format,
51 Self::StrictAndLenientParsing,
52 Self::Matching,
53 Self::Folding,
54 Self::Keys,
55 Self::BuiltInRules,
56 Self::Recipes,
57 Self::LauncherResponsibilities,
58 ];
59
60 #[must_use]
62 pub const fn url(self) -> &'static str {
63 match self {
64 Self::QuickStart => section!("quick-start"),
65 Self::Format => section!("format"),
66 Self::StrictAndLenientParsing => section!("strict-and-lenient-parsing"),
67 Self::Matching => section!("matching"),
68 Self::Folding => section!("folding"),
69 Self::Keys => section!("keys"),
70 Self::BuiltInRules => section!("built-in-rules"),
71 Self::Recipes => section!("recipes"),
72 Self::LauncherResponsibilities => section!("launcher-responsibilities"),
73 }
74 }
75}
76
77impl Key {
78 #[must_use]
80 pub const fn docs_url(self) -> &'static str {
81 match self {
82 Self::Exe => variant!(Exe),
83 Self::Company => variant!(Company),
84 Self::Product => variant!(Product),
85 Self::OriginalFilename => variant!(OriginalFilename),
86 Self::Dxgi => variant!(Dxgi),
87 Self::D3d9 => variant!(D3d9),
88 Self::Wined3d => variant!(Wined3d),
89 Self::OpenGl => variant!(OpenGl),
90 Self::DpiAware => variant!(DpiAware),
91 Self::LargeAddressAware => variant!(LargeAddressAware),
92 Self::Gcmouse => variant!(Gcmouse),
93 Self::ForceNx => variant!(ForceNx),
94 Self::MetalHud => variant!(MetalHud),
95 Self::DllOverrides => variant!(DllOverrides),
96 Self::ArgumentsOverride => variant!(ArgumentsOverride),
97 Self::Arguments => variant!(Arguments),
98 Self::DebugChannels => variant!(DebugChannels),
99 Self::Env => variant!(Env),
100 }
101 }
102}
103
104#[cfg(test)]
105mod tests;