aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2023-03-05 20:23:24 +0100
committerHampusM <hampus@hampusmat.com>2023-03-05 20:31:47 +0100
commit3f26d9e7ebadb145fde8d5dcc60429c7ba4c2399 (patch)
tree4b16a9111b1f911bd26ec0c636e6de4b80ea730c
parent3d9c9d7ac68a439a29c8ad0a745a7e2a52234a44 (diff)
refactor: clarify name of the gl_command replaced ident
-rw-r--r--src/lib.rs8
-rw-r--r--src/repeat.rs10
2 files changed, 9 insertions, 9 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 555cd58..653935a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -14,7 +14,7 @@ mod repeat;
mod str;
mod token_stream;
-const OPENGL_CMD_IDENT_REPLACE: &str = "gl_command";
+const OPENGL_CMD_NAME_REPLACE: &str = "gl_command_name";
const OPENGL_CMD_RET_TYPE_REPLACE: &str = "gl_command_ret_type";
const OPENGL_CMD_ARGS_REPLACE: &str = "gl_command_args";
const OPENGL_CMD_ARG_NAMES_REPLACE: &str = "gl_command_arg_names";
@@ -29,7 +29,7 @@ static OPENGL_REGISTRY: Lazy<Registry> = Lazy::new(|| Registry::retrieve().unwra
///
/// ### The following identifiers will be replaced
///
-/// **`gl_command`**<br>
+/// **`gl_command_name`**<br>
/// Will be replaced by the full command name. For example, `glViewport`.
///
/// **`gl_command_ret_type`**<br>
@@ -49,9 +49,9 @@ static OPENGL_REGISTRY: Lazy<Registry> = Lazy::new(|| Registry::retrieve().unwra
/// ```
/// # use opengl_registry_macros::for_each_opengl_command;
/// for_each_opengl_command! {
-/// fn #gl_command()
+/// fn #gl_command_name()
/// {
-/// println!("Hello from {}", stringify!(#gl_command));
+/// println!("Hello from {}", stringify!(#gl_command_name));
/// }
/// }
/// ```
diff --git a/src/repeat.rs b/src/repeat.rs
index fe7523c..668fefb 100644
--- a/src/repeat.rs
+++ b/src/repeat.rs
@@ -10,7 +10,7 @@ use crate::{
OPENGL_CMD_ARGS_REPLACE,
OPENGL_CMD_ARG_NAMES_REPLACE,
OPENGL_CMD_ARG_TYPES_REPLACE,
- OPENGL_CMD_IDENT_REPLACE,
+ OPENGL_CMD_NAME_REPLACE,
OPENGL_CMD_RET_TYPE_REPLACE,
};
@@ -24,7 +24,7 @@ pub fn for_each_opengl_command_impl(
.iter()
.map(|gl_command| {
let stream = input_stream.replace_ident(
- &Ident::new(OPENGL_CMD_IDENT_REPLACE, Span::call_site()),
+ &Ident::new(OPENGL_CMD_NAME_REPLACE, Span::call_site()),
&TokenTree::Ident(Ident::new(
gl_command.prototype().name(),
Span::call_site(),
@@ -154,8 +154,8 @@ mod tests
for_each_opengl_command_impl(
&quote! {
unsafe {
- functions::#ht gl_command = FunctionPtr::new_initialized(
- get_proc_addr(stringify!(#ht gl_command))
+ functions::#ht gl_command_name = FunctionPtr::new_initialized(
+ get_proc_addr(stringify!(#ht gl_command_name))
);
}
},
@@ -185,7 +185,7 @@ mod tests
assert_eq!(
for_each_opengl_command_impl(
&quote! {
- fn #ht gl_command(#ht gl_command_args) -> #ht gl_command_ret_type {}
+ fn #ht gl_command_name(#ht gl_command_args) -> #ht gl_command_ret_type {}
},
&registry,
)