mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-16 08:18:59 +00:00
prefer std.meta.fieldNames for creating the array
This commit is contained in:
@@ -112,16 +112,6 @@ pub const Extension = union(enum) {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/// An array of supported WebGL extensions.
|
|
||||||
const extension_array = blk: {
|
|
||||||
const fields = @typeInfo(Extension.Kind).@"enum".fields;
|
|
||||||
var items: [fields.len][:0]const u8 = undefined;
|
|
||||||
for (fields, 0..) |field, i| {
|
|
||||||
items[i] = field.name;
|
|
||||||
}
|
|
||||||
break :blk items;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Enables a WebGL extension.
|
/// Enables a WebGL extension.
|
||||||
pub fn _getExtension(self: *const WebGLRenderingContext, name: []const u8) ?Extension {
|
pub fn _getExtension(self: *const WebGLRenderingContext, name: []const u8) ?Extension {
|
||||||
_ = self;
|
_ = self;
|
||||||
@@ -136,5 +126,5 @@ pub fn _getExtension(self: *const WebGLRenderingContext, name: []const u8) ?Exte
|
|||||||
|
|
||||||
/// Returns a list of all the supported WebGL extensions.
|
/// Returns a list of all the supported WebGL extensions.
|
||||||
pub fn _getSupportedExtensions(_: *const WebGLRenderingContext) []const []const u8 {
|
pub fn _getSupportedExtensions(_: *const WebGLRenderingContext) []const []const u8 {
|
||||||
return &extension_array;
|
return std.meta.fieldNames(Extension.Kind);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user