Skip to content

Commit

Permalink
update pass_module types
Browse files Browse the repository at this point in the history
Co-authored-by: David Hewitt <[email protected]>
  • Loading branch information
Icxolu and davidhewitt authored Mar 3, 2024
1 parent 3f90b9f commit 9d9d64f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion guide/src/function.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ The `#[pyo3]` attribute can be used to modify properties of the generated Python

- <a name="pass_module" ></a> `#[pyo3(pass_module)]`

Set this option to make PyO3 pass the containing module as the first argument to the function. It is then possible to use the module in the function body. The first argument **must** be of type `&Bound<'_, PyModule>`.
Set this option to make PyO3 pass the containing module as the first argument to the function. It is then possible to use the module in the function body. The first argument **must** be of type `&Bound<'_, PyModule>`, `Bound<'_, PyModule>`, or `Py<PyModule>`.

The following example creates a function `pyfunction_with_module` which returns the containing module's name (i.e. `module_with_fn`):

Expand Down

0 comments on commit 9d9d64f

Please sign in to comment.