Skip to content

Commit

Permalink
Added docs to pymod function
Browse files Browse the repository at this point in the history
  • Loading branch information
AtomicGamer9523 committed Dec 30, 2023
1 parent 7b4a98b commit 1774431
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions arc/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@
/// ```
#[macro_export]
macro_rules! pymod {
(
$module_name: ident -> $submodule_func: path, $module_path: literal, $py:ident, $m: ident
) => {
// Explanation:
//
// 1. We create the submodule via PyModule::new
// 2. Call that the function that represents the submodule (providing py, so this module)
// 3. Then we add the submodule to the parent module. (m.add_submodule(module_name))
// 4. Finally, run a python script to add the submodule to sys.modules.
($module_name: ident -> $submodule_func: path, $module_path: literal, $py:ident, $m: ident) => {
let $module_name = PyModule::new($py, ::core::stringify!($module_name))?;
$submodule_func($py, $module_name)?;
$m.add_submodule($module_name)?;
Expand Down

0 comments on commit 1774431

Please sign in to comment.