pyo3_pytests/
sequence.rs
1use pyo3::prelude::*;
2use pyo3::types::PyString;
3
4#[pyfunction]
5fn vec_to_vec_i32(vec: Vec<i32>) -> Vec<i32> {
6 vec
7}
8
9#[pyfunction]
10fn array_to_array_i32(arr: [i32; 3]) -> [i32; 3] {
11 arr
12}
13
14#[pyfunction]
15fn vec_to_vec_pystring(vec: Vec<Bound<'_, PyString>>) -> Vec<Bound<'_, PyString>> {
16 vec
17}
18
19#[pymodule(gil_used = false)]
20pub fn sequence(m: &Bound<'_, PyModule>) -> PyResult<()> {
21 m.add_function(wrap_pyfunction!(vec_to_vec_i32, m)?)?;
22 m.add_function(wrap_pyfunction!(array_to_array_i32, m)?)?;
23 m.add_function(wrap_pyfunction!(vec_to_vec_pystring, m)?)?;
24 Ok(())
25}