Open
Description
For instance, you cannot currently do
let v = vec![Vector3::new(1.0, 2.0, 3.0)];
let packed: PackedVector3Array = v.into();
This could be fixed with a From<Vec<Vector3>>
impl for PackedVector3Array
.
In general since packed arrays are very similar to Vec
we could also take inspiration from what Vec
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 first
Other 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 first
Additionally we apparently have From<&VariantArray> for PackedVector3Array
etc, which is wrong. (looking at the implementation this might actually be UB).