Skip to content

How can I register a py class method into rust as a callback func and delay exec it when event comes? #3011

Answered by adamreichold
sun-rs asked this question in Questions
Discussion options

You must be logged in to vote

Get a handle on the method itself using let method: Py<PyAny> = object.getattr("method-name")?.into(); where object is a &PyCell<MyRustClass>. You can store method where you want and when the time comes call it using method.call1(py, (...))?;.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@sun-rs
Comment options

@adamreichold
Comment options

Answer selected by sun-rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants