Skip to content

Returning Arc from #[pyclass]/#[pyfunction] #2131

Answered by ntakouris
ntakouris asked this question in Questions
Discussion options

You must be logged in to vote

I made a

#[pyclass]
pub struct TokenWrapper {
    node_runner: Arc<Token>,
}

and then on the python functions, you can accept a PyRef<TokenWrapper>.

This could be automated with some macro implementing traits, generic trait implementations or maybe pyclass support for type aliases?

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ntakouris
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant