Attribute Macro pyo3::proc_macro::pyfunction[][src]

#[pyfunction]
This is supported on crate feature macros only.
Expand description

A proc macro used to expose Rust functions to Python.

Functions annotated with #[pyfunction] can also be annotated with the following #[pyo3] options:

AnnotationDescription
#[pyo3(name = "...")]Defines the name of the function in Python.
#[pyo3(text_signature = "...")]Defines the __text_signature__ attribute of the function in Python.
#[pyo3(pass_module)]Passes the module containing the function as a &PyModule first argument to the function.

For more on exposing functions see the function section of the guide.