Replies: 2 comments 2 replies
-
You can store the function objects in the Context as If they are always methods you can also only store the object that has the methods and call them on it. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Take a look at https://pyo3.rs/v0.16.2/class/call.html, it shows how to hold Python functions in Rust and how to call them. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have Some Rust code like below, it is a fixed rule to run. But I want to register some flexible Python func in it to achieve
Fixed System Struct + Flexible User Logic
. The Rust structApp
has aRun
func which takes in a struct that implementedContext
trait.While in Python , I have a class to execute the user code like below:
How could I register the Python class method
def on_calculation
into Rust and interactive the result with Pyo3? I couldn't find an example like that.Beta Was this translation helpful? Give feedback.
All reactions