-
Notifications
You must be signed in to change notification settings - Fork 314
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
impl Borrow<&ArrayBase<ViewRepr<&T>, _>>
for ArrayBase<OwnedRepr<T>, _>
#878
Comments
Probably the implementation of |
Unfortunately, this is not possible in current Rust. (Who would own the To do something like this, we need the language to support custom dynamically-sized types, i.e. custom "fat pointers." (The shape/strides/etc. would be stored in the fat pointer itself.) It's worth noting that current proposals, e.g. rust-lang/rfcs#2594, would make it possible to return |
The crate indexmap implements a more mechanism for this (instead of Borrow) - its Equivalence trait should make it possible to implement this, if you also use indexmap's hash table implementation. |
I realized that my initial response was misleading. It's not possible to implement |
If possible, the trait specified in the title would make it easier to store owned arrays in a (Hash)Map and retrieve them without the need to build a new owned array (performing allocations).
The text was updated successfully, but these errors were encountered: