-
Notifications
You must be signed in to change notification settings - Fork 784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] FromPyObject for #[pyclass] with T: Clone #730
Conversation
Nice 👍 , thank you. |
Sure thing, take as long as you like! I tried myself to do some simplifications but couldn't get much further than what's above. It is possible to add some blanket |
I did spot a slight simplification! Also, I realised that if I work the It isn't perfect and it's really un-ergonomic to have to implement So we might want to think a bit longer about this idea. I think if we can find a nice API for it then we can use it to remove specialization from |
Sorry for the lazy review, but after playing around the code, I'm really convinced that this is almost the minimal change 👍 |
Just a note: |
Ok. I'm closing in on a design I like for the Once that's ready I'll open it as a PR against pyO3 and then we can choose whether to take this simpler change, or the bigger design change from that PR. |
541d875
to
fdf407e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've addressed all your comments and squashed to a single commit. One thing I've pointed out for you but otherwise this is ready to merge.
Having thought about the Vec<T>
specialization more, the design I've settled on does not impact this design any more. So please merge this PR without waiting for whatever I come up with there.
@@ -152,7 +152,7 @@ pub mod buffer; | |||
#[doc(hidden)] | |||
pub mod callback; | |||
pub mod class; | |||
mod conversion; | |||
pub mod conversion; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only change which you might want to check. I think this is acceptable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Thank you! |
I had an idea how to support extracting for pyclasses automatically for
T: Clone
.It also has really nice error messages if the user attempts to extract a non-clone
#[pyclass]
(see theui
test).Closes #706