aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2023-04-02 21:26:03 +0200
committerHampusM <hampus@hampusmat.com>2023-04-02 21:27:14 +0200
commit1d4b9844fe9a2c934cd7efe4e7fab8dc15ed60cb (patch)
treec8b839a7f9bf281a468aa4ea159904e3b92e177f
parent4c773728ea4394a65bae65ee6b79e9a30c6931b2 (diff)
feat: make for_each_opengl_command exclude remove commandsHEADmaster
-rw-r--r--src/repeat.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/repeat.rs b/src/repeat.rs
index 8191500..f8ab228 100644
--- a/src/repeat.rs
+++ b/src/repeat.rs
@@ -1,6 +1,7 @@
use std::str::FromStr;
use convert_case::{Case, Casing};
+use opengl_registry::api_interface_definition::FeatureKind;
use opengl_registry::Registry;
use proc_macro2::{Delimiter, Group, Ident, Span, TokenStream, TokenTree};
@@ -20,9 +21,26 @@ pub fn for_each_opengl_command_impl(
opengl_registry: &Registry,
) -> TokenStream
{
+ let removed_commands = opengl_registry
+ .api_interface_definitions()
+ .iter()
+ .flat_map(|api_interface_def| {
+ api_interface_def.removals().iter().flat_map(|removal| {
+ removal.features().iter().filter_map(|feature| {
+ if feature.kind() != FeatureKind::Command {
+ return None;
+ }
+
+ Some(feature.name())
+ })
+ })
+ })
+ .collect::<Vec<_>>();
+
let out: TokenStream = opengl_registry
.commands()
.iter()
+ .filter(|gl_command| !removed_commands.contains(&gl_command.prototype().name()))
.map(|gl_command| {
let stream = input_stream.replace_ident(
&Ident::new(OPENGL_CMD_NAME_REPLACE, Span::call_site()),