You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For code which is generic over the Index or IndexMut traits, it would be helpful if ArrayVec would implement the Index and IndexMut traits (in core::ops). I understand and like that you prefer ArrayVec methods not to panic but rather return a Result or Option, and I see I can use the get and get_mut functions and then unwrap myself, but for code generic over these traits this does not help (much).
Precedence for implementing Index<I> and IndexMut<I> where I: SliceIndex<[T]> (even though the methods may panic):
(primitive) arrays
std::vec::Vec
smallvec::SmallVec (from the popular smallvec crate)
tinyvec::ArrayVec (from the tinyvec crate)
The text was updated successfully, but these errors were encountered:
Now panic or not has nothing to do with it, you can already index arrayvec because it derefs to slice. If possible in a good way, we should impl Index too. The complexity of slice's index impls could make them hard to match(?)
For code which is generic over the
Index
orIndexMut
traits, it would be helpful ifArrayVec
would implement theIndex
andIndexMut
traits (incore::ops
). I understand and like that you preferArrayVec
methods not to panic but rather return aResult
orOption
, and I see I can use theget
andget_mut
functions and thenunwrap
myself, but for code generic over these traits this does not help (much).Precedence for implementing
Index<I>
andIndexMut<I>
whereI: SliceIndex<[T]>
(even though the methods may panic):std::vec::Vec
smallvec::SmallVec
(from the popularsmallvec
crate)tinyvec::ArrayVec
(from thetinyvec
crate)The text was updated successfully, but these errors were encountered: