-
Notifications
You must be signed in to change notification settings - Fork 770
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
Generic lists #903
Comments
I think |
Thank you for getting back to me. Unfortunately,
If this is what's currently possible, then all I need is to convert from a |
I don't believe
|
I think it's required (for the blanket impl) for how #[pyclass]
struct Test {
#[pyo3(get)]
items: Vec<PyObject>
} I have an idea how to fix this, will raise a PR later... |
Indeed, I didn't think of the getter attribute. For the fix, are you thinking of a ClonePy trait (analogous to FromPy and IntoPy)? |
I think ClonePy is a bit janky - I think I might be able to go one better and add |
We cannot clone(=refcnt += 1) But I think what is really useful is zero-copy |
For clone - see #908 😄
Would be very happy to see this! In my experience in C++ this used template specialization, so hopefully we can find a way without specialization here. |
❓ Support request
Apologies if this is not the correct forum to post support requests - I couldn't find a more appropriate channel.
ℹ Setup
I have the following struct defined.
Now,
#[pyclass]
does not allow for using generics, which is too bad, but I'm sure there's a technical reason behind it. That's quite alright, I suppose - I thought I could simply define another struct that's the Python representation like so.Here is my conversion code as of now.
⚠ Problem
What I cannot figure out, however, is how can I actually have
pyo3
convert to and from this representation.PyArray::items
?Vec<T>
in myimpl
block?The text was updated successfully, but these errors were encountered: