-
Notifications
You must be signed in to change notification settings - Fork 1.4k
sequence protocol #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
sequence protocol #770
Conversation
Codecov Report
@@ Coverage Diff @@
## master #770 +/- ##
==========================================
+ Coverage 62.04% 62.17% +0.13%
==========================================
Files 80 80
Lines 12722 12643 -79
Branches 2620 2596 -24
==========================================
- Hits 7893 7861 -32
+ Misses 3159 3122 -37
+ Partials 1670 1660 -10
Continue to review full report at Codecov.
|
| where | ||
| Self: Sized, | ||
| { | ||
| fn get_elements(&self) -> Vec<PyObjectRef>; |
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.
we definitely don't want to copy the entire vec just to eg check its size.
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.
Agree. I can't do a Deref inside the trait. Do you have a suggestion for something nicer then returning the Refcell?
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.
You could try returning an &[PyObjectRef], or if that wouldn't work an impl Deref<Target = [PyObjectRef]>.
| { | ||
| fn get_elements(&self) -> Vec<PyObjectRef>; | ||
| fn as_object(&self) -> &PyObjectRef; | ||
| fn into_object(self) -> PyObjectRef; |
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 think this could be split off into a separate trait, and we could have a generic impl<T> ... for PyRef<T>
|
Should be implemented with inner like #785. |
Same as #765 but for
tupleandlist.