-
-
Notifications
You must be signed in to change notification settings - Fork 254
Closed
Labels
c: coreCore componentsCore componentsgood first issueGood for newcomersGood for newcomersquality-of-lifeNo new functionality, but improves ergonomics/internalsNo new functionality, but improves ergonomics/internals
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>IndexandIndexMut, i think we can useI: SliceIndexlikeVecdoes.IntoIteratorWrite, forPackedByteArrayonly but preferably have a use-case first
Other trait impls we can consider:
DerefandDerefMutto[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).
AJ213
Metadata
Metadata
Assignees
Labels
c: coreCore componentsCore componentsgood first issueGood for newcomersGood for newcomersquality-of-lifeNo new functionality, but improves ergonomics/internalsNo new functionality, but improves ergonomics/internals