Packed Arrays could use some more trait impls #663
Labels
c: core
Core components
good first issue
Good for newcomers
quality-of-life
No new functionality, but improves ergonomics/internals
For instance, you cannot currently do
This could be fixed with a
From<Vec<Vector3>>
impl forPackedVector3Array
.In general since packed arrays are very similar to
Vec
we could also take inspiration from whatVec
has implemented.See discussion below for more details.
Traits to implement:
From<Vec<T>>
From<[T; N]>
From<Array<T>>
From<PackedTArray> for Array<T>
Index
andIndexMut
, i think we can useI: SliceIndex
likeVec
does.IntoIterator
Write
, forPackedByteArray
only but preferably have a use-case firstOther trait impls we can consider:
Deref
andDerefMut
to[T]
. may conflict with Godot's api for packed arraysFrom<Box<[T]>>
,From<VecDeque<T>>
. We can already do this withcollect()
AsRef<[T]>
,AsMut<[T]>
,Borrow<[T]>
,BorrowMut<[T]>
. Should have a use-case firstAdditionally we apparently have
From<&VariantArray> for PackedVector3Array
etc, which is wrong. (looking at the implementation this might actually be UB).The text was updated successfully, but these errors were encountered: