-
Couldn't load subscription status.
- Fork 9
Add Borrow<Array<T, _>>/BorrowMut impls for [T; N]
#134
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
Conversation
Provides an alternative to #133 using the less commonly used `Borrow` trait instead, which should still make the same patterns of exposing APIs with core arrays possible, but hopefully while causing less breakage in end user code.
1f293a9 to
b81b313
Compare
Borrow<Array<_, _>>/BorrowMut impls for [T; N]Borrow<Array<T, _>>/BorrowMut impls for [T; N]
|
@kayabaNerve I tried this out on your code and everything seems fine. I expect since |
|
I probably should've posted a potential alternative, which would be to modify the |
Impl'd for `Array<T, U>` and `[T; N]`. This is an alternative to #134, given the trouble we had in #131 with adding impls of core traits to `[T; N]` and the ensuing inference conflicts it can cause. The safest thing we can do is define our own traits, and these traits bound on `AssocArraySize` so they're able to handle everything related to the array size themselves, making them generic around only `T`. With this we can revert #134, which still has the potential to cause problems similar to #131. Using our own trait guarantees we won't break inference in existing code.
Impl'd for `Array<T, U>` and `[T; N]`. This is an alternative to #134, given the trouble we had in #131 with adding impls of core traits to `[T; N]` and the ensuing inference conflicts it can cause. The safest thing we can do is define our own traits, and these traits bound on `AssocArraySize` so they're able to handle everything related to the array size themselves, making them generic around only `T`. With this we can revert #134, which still has the potential to cause problems similar to #131. Using our own trait guarantees we won't break inference in existing code.
Impl'd for `Array<T, U>` and `[T; N]`. This is an alternative to #134, given the trouble we had in #131 with adding impls of core traits to `[T; N]` and the ensuing inference conflicts it can cause. The safest thing we can do is define our own traits, and these traits bound on `AssocArraySize` so they're able to handle everything related to the array size themselves, making them generic around only `T`. With this we can revert #134, which still has the potential to cause problems similar to #131. Using our own trait guarantees we won't break inference in existing code.
Impl'd for `Array<T, U>` and `[T; N]`. This is an alternative to #134, given the trouble we had in #131 with adding impls of core traits to `[T; N]` and the ensuing inference conflicts it can cause. The safest thing we can do is define our own traits, and these traits bound on `AssocArraySize` so they're able to handle everything related to the array size themselves, making them generic around only `T`. With this we can revert #134, which still has the potential to cause problems similar to #131. Using our own trait guarantees we won't break inference in existing code.
|
I do have some code that uses Using hybrid-array traits also sounds perfect, but I'll leave it to you. |
Provides an alternative to #133 using the less commonly used
Borrowtrait instead, which should still make the same patterns of exposing APIs with core arrays possible, but hopefully while causing less breakage in end user code.