diff options
author | HampusM <hampus@hampusmat.com> | 2024-10-16 23:47:23 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2024-10-17 00:11:53 +0200 |
commit | aace257e08f3a73c22dfc80ca1f1df1b8f550fc1 (patch) | |
tree | 633ecdb4e6e44dadc0e07139aad9939041f862dc /glfw/src/util.rs | |
parent | 8ecd728f14da6ce1376822557fd63d3002a380de (diff) |
refactor(glfw): use FromRepr derive macro from util-macros
Diffstat (limited to 'glfw/src/util.rs')
-rw-r--r-- | glfw/src/util.rs | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/glfw/src/util.rs b/glfw/src/util.rs index 98dcb9b..f77aaf8 100644 --- a/glfw/src/util.rs +++ b/glfw/src/util.rs @@ -8,34 +8,3 @@ pub fn is_main_thread() -> bool ttid == pid } - -macro_rules! enum_from_repr { - ( - #[repr($repr: ident)] - $(#[$attr: meta])* - $visibility: vis enum $name: ident - { - $($variant: ident = $raw: path,)* - } - ) => { - $(#[$attr])* - #[repr($repr)] - $visibility enum $name - { - $($variant = $raw,)* - } - - impl $name - { - fn from_repr(repr: $repr) -> Option<Self> - { - match repr { - $($raw => Some(Self::$variant),)* - _ => None - } - } - } - }; -} - -pub(crate) use enum_from_repr; |