pyo3_pytests/path.rs
1use pyo3::prelude::*;
2use std::path::{Path, PathBuf};
3
4#[pyfunction]
5fn make_path() -> PathBuf {
6 Path::new("/root").to_owned()
7}
8
9#[pyfunction]
10fn take_pathbuf(path: PathBuf) -> PathBuf {
11 path
12}
13
14#[pymodule(gil_used = false)]
15pub fn path(m: &Bound<'_, PyModule>) -> PyResult<()> {
16 m.add_function(wrap_pyfunction!(make_path, m)?)?;
17 m.add_function(wrap_pyfunction!(take_pathbuf, m)?)?;
18
19 Ok(())
20}