-
I am making a crate for both python and rust user. The structure of my crate is like below. ├── src
│ ├── lib.rs <- python binding
│ ├── core.rs <- pure rust functions Currently, all rust functions are in My question is that if it is possible to seperate the code for binding from ├── src
│ ├── lib.rs
│ ├── python_binding.rs <- for python user
│ ├── core.rs <- pure rust functions So if user compild it with a feature flag, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Yes, you can do that. You just need to make pyo3 an optional dependency and use a bunch of |
Beta Was this translation helpful? Give feedback.
Thank you for your help. I eventually solved the problem by enabling
extension-module
feature of pyo3. So thatCargo.toml
should look like below.