-
Notifications
You must be signed in to change notification settings - Fork 120
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
Drop as_cell_slice
and add raw array views instead
#260
Conversation
pyo3::Python::with_gil(|py| { | ||
let not_contiguous = not_contiguous_array(py); | ||
let raw_array_view = not_contiguous.as_raw_array(); | ||
assert_eq!(unsafe { raw_array_view.deref_into_view()[0] }, 1); |
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.
One downside appears to be that ndarray does not provide indexing into raw views, only dereferencing the whole view.
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.
Yeah it's not very userfriendly, but I think this is rather a downside of raw view, not that of having conversion API
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.
Opened rust-ndarray/ndarray#1151 to expand the ndarray interface.
d234b53
to
46af291
Compare
…e absence of aliasing views cannot be guaranteed.
46af291
to
eb37647
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.
Thank you!
pyo3::Python::with_gil(|py| { | ||
let not_contiguous = not_contiguous_array(py); | ||
let raw_array_view = not_contiguous.as_raw_array(); | ||
assert_eq!(unsafe { raw_array_view.deref_into_view()[0] }, 1); |
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.
Yeah it's not very userfriendly, but I think this is rather a downside of raw view, not that of having conversion API
The first and already discussed fix towards a resolution of #258