From b74ab18681ea9f3e7066c481b50b3001f8cda543 Mon Sep 17 00:00:00 2001 From: sagudev <16504129+sagudev@users.noreply.github.com> Date: Tue, 7 Jan 2025 06:54:41 +0100 Subject: [PATCH] refactor: reimpl. `ImplementedLanguageExtension::all` w/ `strum::VariantArray` Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --- naga/Cargo.toml | 2 +- naga/src/front/wgsl/parse/directive/language_extension.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/naga/Cargo.toml b/naga/Cargo.toml index 0cbd0f4368d..54931163c7d 100644 --- a/naga/Cargo.toml +++ b/naga/Cargo.toml @@ -75,6 +75,7 @@ codespan-reporting = { version = "0.11.0" } rustc-hash.workspace = true indexmap.workspace = true log = "0.4" +strum.workspace = true spirv = { version = "0.3", optional = true } thiserror.workspace = true serde = { version = "1.0.217", features = ["derive"], optional = true } @@ -102,4 +103,3 @@ ron = "0.8.0" rspirv = { version = "0.11", git = "https://github.com/gfx-rs/rspirv", rev = "b969f175d5663258b4891e44b76c1544da9661ab" } serde = { workspace = true, features = ["derive"] } spirv = { version = "0.3", features = ["deserialize"] } -strum.workspace = true diff --git a/naga/src/front/wgsl/parse/directive/language_extension.rs b/naga/src/front/wgsl/parse/directive/language_extension.rs index ead6f7efb14..92980b5563c 100644 --- a/naga/src/front/wgsl/parse/directive/language_extension.rs +++ b/naga/src/front/wgsl/parse/directive/language_extension.rs @@ -2,6 +2,8 @@ //! //! The focal point of this module is the [`LanguageExtension`] API. +use strum::VariantArray; + /// A language extension recognized by Naga, but not guaranteed to be present in all environments. /// /// WGSL spec.: @@ -61,15 +63,13 @@ impl LanguageExtension { } /// A variant of [`LanguageExtension::Implemented`]. -#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, VariantArray)] pub enum ImplementedLanguageExtension {} impl ImplementedLanguageExtension { - const ALL: [ImplementedLanguageExtension; 0] = []; - /// Returns slice of all variants of [`ImplementedLanguageExtension`]. pub const fn all() -> &'static [Self] { - &Self::ALL + Self::VARIANTS } /// Maps this [`ImplementedLanguageExtension`] into the sentinel word associated with it in WGSL.