2021-03-09 23:37:01 +00:00
|
|
|
use pyo3::prelude::*;
|
2024-04-14 14:19:57 +00:00
|
|
|
use pyo3::types::{PyDict, PyString, PyTuple};
|
2021-03-09 23:37:01 +00:00
|
|
|
|
|
|
|
#[pyfunction]
|
2024-05-03 07:42:30 +00:00
|
|
|
fn generic_function<T>(_value: T) {}
|
2021-03-09 23:37:01 +00:00
|
|
|
|
|
|
|
#[pyfunction]
|
2024-05-03 07:42:30 +00:00
|
|
|
fn impl_trait_function(_impl_trait: impl AsRef<PyAny>) {}
|
2021-03-09 23:37:01 +00:00
|
|
|
|
2023-03-07 14:18:57 +00:00
|
|
|
#[pyfunction]
|
|
|
|
fn wildcard_argument(_: i32) {}
|
|
|
|
|
|
|
|
#[pyfunction]
|
2024-05-03 07:42:30 +00:00
|
|
|
fn destructured_argument((_a, _b): (i32, i32)) {}
|
2023-03-07 14:18:57 +00:00
|
|
|
|
2023-06-13 07:19:43 +00:00
|
|
|
#[pyfunction]
|
|
|
|
fn function_with_required_after_option(_opt: Option<i32>, _x: i32) {}
|
|
|
|
|
2024-04-14 14:19:57 +00:00
|
|
|
#[pyfunction]
|
|
|
|
#[pyo3(signature=(*args))]
|
2024-05-03 07:42:30 +00:00
|
|
|
fn function_with_optional_args(args: Option<Bound<'_, PyTuple>>) {
|
|
|
|
let _ = args;
|
|
|
|
}
|
2024-04-14 14:19:57 +00:00
|
|
|
|
|
|
|
#[pyfunction]
|
|
|
|
#[pyo3(signature=(**kwargs))]
|
2024-05-03 07:42:30 +00:00
|
|
|
fn function_with_required_kwargs(kwargs: Bound<'_, PyDict>) {
|
|
|
|
let _ = kwargs;
|
|
|
|
}
|
2024-04-14 14:19:57 +00:00
|
|
|
|
2023-11-24 03:11:05 +00:00
|
|
|
#[pyfunction(pass_module)]
|
|
|
|
fn pass_module_but_no_arguments<'py>() {}
|
|
|
|
|
|
|
|
#[pyfunction(pass_module)]
|
2024-03-20 22:35:08 +00:00
|
|
|
fn first_argument_not_module<'a, 'py>(
|
2024-05-03 07:42:30 +00:00
|
|
|
_string: &str,
|
|
|
|
module: &'a Bound<'py, PyModule>,
|
2024-03-20 22:35:08 +00:00
|
|
|
) -> PyResult<Bound<'py, PyString>> {
|
2023-11-24 03:11:05 +00:00
|
|
|
module.name()
|
|
|
|
}
|
|
|
|
|
2021-03-09 23:37:01 +00:00
|
|
|
fn main() {}
|