Can anyone provide an example of inputting and outputting dynamic content? #2332
Replies: 2 comments 1 reply
-
For code examples, you might want to look at some of the crates listed in PyO3's README: https://github.com/PyO3/pyo3#examples If you want a release build with maturin, you need to run |
Beta Was this translation helpful? Give feedback.
-
Can you show me where in the documentation you got that impression? Wherever you can return |
Beta Was this translation helpful? Give feedback.
-
Hi everyone, I worked with this program about two years ago, and after I recently refocused on it, I noticed there's some considerable change from the way I used it before. In my previous experience, I needed to introduce
wrap_pyfunction
and writepy: Python
as the first argument of all python functions,Now that seems they've been removed, some of the changes are confusing to me (someone who hasn't written any rust code in the past two years, let's say look like you need to add
PyResult
to all return value now). I am wondering if someone can provide a standardlib.rs
example that teaches me how to input python data structures into rust, I need to inputlist
(one dimensional & two dimensional), bytes and strings, and again I need rust to be able to return them. Unfortunately, these are dynamic data that cannot be determined in length before input, and I cannot understand well the process how pyo3 transforms these dynamic data currently.Also maturin is a new tool to me that doesn't require us to run
cargo build --release
like we did before, I would like to know if used in a production environment whether thematurin develop
command is compiling the program under--release
.Can anyone give any help? Thanks very much!
Beta Was this translation helpful? Give feedback.
All reactions