@@ -37,7 +37,7 @@ use crate::registry::property::{BuiltinExport, Export, Var};
3737/// Godot's `Array` can be either typed or untyped.
3838///
3939/// An untyped array can contain any kind of [`Variant`], even different types in the same array.
40- /// We represent this in Rust as `VariantArray `, which is just a type alias for `Array<Variant>`.
40+ /// We represent this in Rust as `VarArray `, which is just a type alias for `Array<Variant>`.
4141///
4242/// Godot also supports typed arrays, which are also just `Variant` arrays under the hood, but with
4343/// runtime checks, so that no values of the wrong type are inserted into the array. We represent this as
@@ -93,8 +93,8 @@ use crate::registry::property::{BuiltinExport, Export, Var};
9393///
9494/// ```no_run
9595/// # use godot::prelude::*;
96- /// // VariantArray allows dynamic element types.
97- /// let mut array = VariantArray ::new();
96+ /// // VarArray allows dynamic element types.
97+ /// let mut array = VarArray ::new();
9898/// array.push(&10.to_variant());
9999/// array.push(&"Hello".to_variant());
100100///
@@ -191,11 +191,14 @@ impl<'a> std::ops::Deref for ImmutableInnerArray<'a> {
191191 }
192192}
193193
194- /// A Godot `Array` without an assigned type.
194+ # [ deprecated = "Renamed to `VarArray`." ]
195195pub type VariantArray = Array < Variant > ;
196196
197+ /// Untyped Godot `Array`.
198+ pub type VarArray = Array < Variant > ;
199+
197200// TODO check if these return a typed array
198- impl_builtin_froms ! ( VariantArray ;
201+ impl_builtin_froms ! ( VarArray ;
199202 PackedByteArray => array_from_packed_byte_array,
200203 PackedColorArray => array_from_packed_color_array,
201204 PackedFloat32Array => array_from_packed_float32_array,
@@ -208,7 +211,7 @@ impl_builtin_froms!(VariantArray;
208211) ;
209212
210213#[ cfg( since_api = "4.3" ) ]
211- impl_builtin_froms ! ( VariantArray ;
214+ impl_builtin_froms ! ( VarArray ;
212215 PackedVector4Array => array_from_packed_vector4_array,
213216) ;
214217
@@ -521,7 +524,7 @@ impl<T: ArrayElement> Array<T> {
521524 self . balanced_ensure_mutable ( ) ;
522525
523526 // SAFETY: `append_array` will only read values from `other`, and all types can be converted to `Variant`.
524- let other: & VariantArray = unsafe { other. assume_type_ref :: < Variant > ( ) } ;
527+ let other: & VarArray = unsafe { other. assume_type_ref :: < Variant > ( ) } ;
525528
526529 // SAFETY: `append_array` will only write values gotten from `other` into `self`, and all values in `other` are guaranteed
527530 // to be of type `T`.
@@ -1124,7 +1127,7 @@ fn correct_variant_t() {
11241127 assert ! ( !Array :: <i64 >:: has_variant_t( ) ) ;
11251128}
11261129
1127- impl VariantArray {
1130+ impl VarArray {
11281131 /// # Safety
11291132 /// - Variant must have type `VariantType::ARRAY`.
11301133 /// - Subsequent operations on this array must not rely on the type of the array.
@@ -1165,7 +1168,7 @@ unsafe impl<T: ArrayElement> GodotFfi for Array<T> {
11651168}
11661169
11671170// Only implement for untyped arrays; typed arrays cannot be nested in Godot.
1168- impl ArrayElement for VariantArray { }
1171+ impl ArrayElement for VarArray { }
11691172
11701173impl < T : ArrayElement > GodotConvert for Array < T > {
11711174 type Via = Self ;
@@ -1271,7 +1274,7 @@ where
12711274 fn export_hint ( ) -> PropertyHintInfo {
12721275 // If T == Variant, then we return "Array" builtin type hint.
12731276 if Self :: has_variant_t ( ) {
1274- PropertyHintInfo :: type_name :: < VariantArray > ( )
1277+ PropertyHintInfo :: type_name :: < VarArray > ( )
12751278 } else {
12761279 PropertyHintInfo :: export_array_element :: < T > ( )
12771280 }
@@ -1598,14 +1601,14 @@ macro_rules! array {
15981601 } ;
15991602}
16001603
1601- /// Constructs [`VariantArray `] literals, similar to Rust's standard `vec!` macro.
1604+ /// Constructs [`VarArray `] literals, similar to Rust's standard `vec!` macro.
16021605///
16031606/// The type of the array elements is always [`Variant`].
16041607///
16051608/// # Example
16061609/// ```no_run
16071610/// # use godot::prelude::*;
1608- /// let arr: VariantArray = varray![42_i64, "hello", true];
1611+ /// let arr: VarArray = varray![42_i64, "hello", true];
16091612/// ```
16101613///
16111614/// # See also
@@ -1620,7 +1623,7 @@ macro_rules! varray {
16201623 ( $( $elements: expr) ,* $( , ) ?) => {
16211624 {
16221625 use $crate:: meta:: ToGodot as _;
1623- let mut array = $crate:: builtin:: VariantArray :: default ( ) ;
1626+ let mut array = $crate:: builtin:: VarArray :: default ( ) ;
16241627 $(
16251628 array. push( & $elements. to_variant( ) ) ;
16261629 ) *
@@ -1668,7 +1671,6 @@ macro_rules! vslice {
16681671 ( $( $elements: expr) ,* $( , ) ?) => {
16691672 {
16701673 use $crate:: meta:: ToGodot as _;
1671- let mut array = $crate:: builtin:: VariantArray :: default ( ) ;
16721674 & [
16731675 $( $elements. to_variant( ) , ) *
16741676 ]
0 commit comments