Skip to contentSkip to conversation

rust: add example for `alias` argument in `module` macro documentation

PATCH Applied Aswin Unnikrishnan 4 participants 6 messages May 12, 2024 – Jul 9, 2024 Rust

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 rust: add example for `alias` argument in `module` macro documentation

Add example for alias argument supported by module macro. alias accepts an array of alternate names for the module as string.

---

Changes in v2:
- Add Reviewed-by tag
- Link to v1: https://lore.kernel.org/rust-for-linux/[email protected]/

 rust/macros/lib.rs | 1 +
 1 file changed, 1 insertion(+)
rust/macros/lib.rs +1 -0
index 520eae5fd792..aa89b41fa10e 100644
@@ -35,6 +35,7 @@
 ///     author: "Rust for Linux Contributors",
 ///     description: "My very own kernel module!",
 ///     license: "GPL",
+///     alias: ["alternate_module_name"],
 /// }
 ///
 /// struct MyModule;
Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 2/2 rust: fix datatype in docs for `module` macro arguments

Remove the mention of byte array as datatype for module macro arguments since the arguments are defined as string, and alias is a string array.

---

Changes in v2:
- Add expected string literal type in documentation for module macro
arguments since some module macro arguments expect ASCII string
literals.
- Link to v1: https://lore.kernel.org/rust-for-linux/[email protected]/T/#t

 rust/macros/lib.rs | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
rust/macros/lib.rs +5 -5
index aa89b41fa10e..5214e07367c5 100644
@@ -58,11 +58,11 @@
 ///
 /// # Supported argument types
 ///   - `type`: type which implements the [`Module`] trait (required).
-///   - `name`: byte array of the name of the kernel module (required).
-///   - `author`: byte array of the author of the kernel module.
-///   - `description`: byte array of the description of the kernel module.
-///   - `license`: byte array of the license of the kernel module (required).
-///   - `alias`: byte array of alias name of the kernel module.
+///   - `name`: ASCII string literal of the name of the kernel module (required).
+///   - `author`: string literal of the author of the kernel module.
+///   - `description`: string literal of the description of the kernel module.
+///   - `license`: ASCII string literal of the license of the kernel module (required).
+///   - `alias`: array of ASCII string literals of the alias names of the kernel module.
 #[proc_macro]
 pub fn module(ts: TokenStream) -> TokenStream {
     module::module(ts)
Signature · 1 line
2.43.0