Struct Array
pub struct Array<T>where
T: ArrayElement,{ /* private fields */ }Expand description
Godot’s Array type.
Versatile, linear storage container for all types that can be represented inside a Variant.
For space-efficient storage, consider using PackedArray<T> or Vec<T>.
Check out the book for a tutorial on arrays.
§Reference semantics
Like in GDScript, Array acts as a reference type: multiple Array instances may
refer to the same underlying array, and changes to one are visible in the other.
To create a copy that shares data with the original array, use Clone::clone().
If you want to create a copy of the data, use duplicate_shallow()
or duplicate_deep().
§Element type
Godot’s Array builtin can be either typed or untyped. In Rust, this maps to three representations:
-
Untyped array:
VariantArray, a type alias forArray<Variant>.
An untyped array can contain any kind ofVariant, even different types in the same array. -
Typed:
Array<T>, with any non-VarianttypeTsuch asi64,GString,Gd<T>etc.
Typing is enforced at compile-time in Rust, and at runtime by Godot. -
Either typed or untyped:
AnyArray.
Represents either typed or untyped arrays. This is different fromArray<Variant>, because the latter allows you to insertVariantobjects. However, for an array that has dynamic typei64, it is not allowed to insert any variants that are noti64.
If you plan to use any integer or float types apart from i64 and f64, read
this documentation.
§Conversions between arrays
The following table gives an overview of useful conversions.
| From | To | Conversion method |
|---|---|---|
AnyArray | Array<T> | AnyArray::try_cast_array::<T> |
AnyArray | Array<Variant> | AnyArray::try_cast_var_array |
&Array<T> | &AnyArray | Implicit via deref coercion; often used in class APIs. |
Array<T> | AnyArray | Array<T>::upcast_any_array |
Array<T> | PackedArray<T> | Array<T>::to_packed_array |
PackedArray<T> | Array<T> | PackedArray<T>::to_typed_array |
PackedArray<T> | Array<Variant> | PackedArray<T>::to_var_array |
Note that it’s not possible to upcast Array<Gd<Derived>> to Array<Gd<Base>>. Array<T> is not covariant over the T parameter,
otherwise it would be possible to insert Base pointers that aren’t actually Derived.
§Typed array example
// Create typed Array<i64> and add values.
let mut array = Array::new();
array.push(10);
array.push(20);
array.push(30);
// Or create the same array in a single expression.
let array = array![10, 20, 30];
// Access elements.
let value: i64 = array.at(0); // 10
let maybe: Option<i64> = array.get(3); // None
// Iterate over i64 elements.
for value in array.iter_shared() {
println!("{value}");
}
// Clone array (shares the reference), and overwrite elements through clone.
let mut cloned = array.clone();
cloned.set(0, 50); // [50, 20, 30]
cloned.remove(1); // [50, 30]
cloned.pop(); // [50]
// Changes will be reflected in the original array.
assert_eq!(array.len(), 1);
assert_eq!(array.front(), Some(50));§Untyped array example
// VarArray allows dynamic element types.
let mut array = VarArray::new();
array.push(&10.to_variant());
array.push(&"Hello".to_variant());
// Or equivalent, use the `varray!` macro which converts each element.
let array = varray![10, "Hello"];
// Access elements.
let value: Variant = array.at(0);
let value: i64 = array.at(0).to(); // Variant::to() extracts i64.
let maybe: Result<i64, _> = array.at(1).try_to(); // "Hello" is not i64 -> Err.
let maybe: Option<Variant> = array.get(3);
// ...and so on.§Working with signed ranges and steps
For negative indices, use wrapped().
let arr = array![0, 1, 2, 3, 4, 5];
// The values of `begin` (inclusive) and `end` (exclusive) will be clamped to the array size.
let clamped_array = arr.subarray_deep(999..99999, None);
assert_eq!(clamped_array, array![]);
// If either `begin` or `end` is negative, its value is relative to the end of the array.
let sub = arr.subarray_shallow(wrapped(-1..-5), None);
assert_eq!(sub, array![5, 3]);
// If `end` is not specified, the range spans through whole array.
let sub = arr.subarray_deep(1.., None);
assert_eq!(sub, array![1, 2, 3, 4, 5]);
let other_clamped_array = arr.subarray_shallow(5.., Some(2));
assert_eq!(other_clamped_array, array![5]);
// If specified, `step` is the relative index between source elements. It can be negative,
// in which case `begin` must be higher than `end`.
let sub = arr.subarray_shallow(wrapped(-1..-5), Some(-2));
assert_eq!(sub, array![5, 3]);§Thread safety
Usage is safe if the Array is used on a single thread only. Concurrent reads on
different threads are also safe, but any writes must be externally synchronized. The Rust
compiler will enforce this as long as you use only Rust threads, but it cannot protect against
concurrent modification on other threads (e.g. created through GDScript).
§Element type safety
We provide a richer set of element types than Godot, for convenience and stronger invariants in your Rust code. This, however, means that the Godot representation of such arrays is not capable of incorporating the additional “Rust-side” information. This can lead to situations where GDScript code or the editor UI can insert values that do not fulfill the Rust-side invariants. The library offers some best-effort protection in Debug mode, but certain errors may only occur on element access, in the form of panics.
Concretely, the following types lose type information when passed to Godot. If you want 100% bullet-proof arrays, avoid those.
- Non-
i64integers:i8,i16,i32,u8,u16,u32. (u64is unsupported). - Non-
f64floats:f32. - Non-null objects:
Gd<T>. Godot generally allowsnullin arrays due to default-constructability, e.g. when usingresize(). The Godot-faithful (but less convenient) alternative is to useOption<Gd<T>>element types. - Objects with dyn-trait association:
DynGd<T, D>. Godot doesn’t know Rust traits and will only see theTpart.
§Differences from GDScript
Unlike GDScript, all indices and sizes are unsigned, so negative indices are not supported.
§Godot docs
Implementations§
§impl<T> Array<T>where
T: ArrayElement,
impl<T> Array<T>where
T: ArrayElement,
pub fn get(&self, index: usize) -> Option<T>
pub fn get(&self, index: usize) -> Option<T>
Returns the value at the specified index, or None if the index is out-of-bounds.
If you know the index is correct, use at() instead.
pub fn contains(&self, value: impl AsArg<T>) -> bool
pub fn contains(&self, value: impl AsArg<T>) -> bool
Returns true if the array contains the given value. Equivalent of has in GDScript.
pub fn count(&self, value: impl AsArg<T>) -> usize
pub fn count(&self, value: impl AsArg<T>) -> usize
Returns the number of times a value is in the array.
pub fn hash(&self) -> u32
hash_u32pub fn front(&self) -> Option<T>
pub fn front(&self) -> Option<T>
Returns the first element in the array, or None if the array is empty.
pub fn back(&self) -> Option<T>
pub fn back(&self) -> Option<T>
Returns the last element in the array, or None if the array is empty.
pub fn push(&mut self, value: impl AsArg<T>)
pub fn push(&mut self, value: impl AsArg<T>)
Appends an element to the end of the array.
Godot equivalents: append and push_back
pub fn push_front(&mut self, value: impl AsArg<T>)
pub fn push_front(&mut self, value: impl AsArg<T>)
Adds an element at the beginning of the array, in O(n).
On large arrays, this method is much slower than push(), as it will move all the array’s elements.
The larger the array, the slower push_front() will be.
pub fn pop(&mut self) -> Option<T>
pub fn pop(&mut self) -> Option<T>
Removes and returns the last element of the array. Returns None if the array is empty.
Godot equivalent: pop_back
pub fn pop_front(&mut self) -> Option<T>
pub fn pop_front(&mut self) -> Option<T>
Removes and returns the first element of the array, in O(n). Returns None if the array is empty.
Note: On large arrays, this method is much slower than pop() as it will move all the
array’s elements. The larger the array, the slower pop_front() will be.
pub fn insert(&mut self, index: usize, value: impl AsArg<T>)
pub fn insert(&mut self, index: usize, value: impl AsArg<T>)
⚠️ Inserts a new element before the index. The index must be valid or the end of the array (index == len()).
On large arrays, this method is much slower than push(), as it will move all the array’s elements after the inserted element.
The larger the array, the slower insert() will be.
§Panics
If index > len().
pub fn remove(&mut self, index: usize) -> T
pub fn remove(&mut self, index: usize) -> T
⚠️ Removes and returns the element at the specified index. Equivalent of pop_at in GDScript.
On large arrays, this method is much slower than pop() as it will move all the array’s
elements after the removed element. The larger the array, the slower remove() will be.
§Panics
If index is out of bounds.
pub fn fill(&mut self, value: impl AsArg<T>)
pub fn fill(&mut self, value: impl AsArg<T>)
Assigns the given value to all elements in the array. This can be used together with
resize to create an array with a given size and initialized elements.
pub fn resize(&mut self, new_size: usize, value: impl AsArg<T>)
pub fn resize(&mut self, new_size: usize, value: impl AsArg<T>)
Resizes the array to contain a different number of elements.
If the new size is smaller than the current size, then it removes elements from the end. If the new size is bigger than the current one
then the new elements are set to value.
If you know that the new size is smaller, then consider using shrink instead.
pub fn extend_array(&mut self, other: &Array<T>)
pub fn extend_array(&mut self, other: &Array<T>)
Appends another array at the end of this array. Equivalent of append_array in GDScript.
pub fn duplicate_shallow(&self) -> Array<T>
pub fn duplicate_shallow(&self) -> Array<T>
Returns a shallow copy, sharing reference types (Array, Dictionary, Object…) with the original array.
This operation retains the dynamic [element type][Self::element_type]: copying Array<T> will yield another Array<T>.
To create a deep copy, use duplicate_deep() instead.
To create a new reference to the same array data, use clone().
pub fn duplicate_deep(&self) -> Array<T>
pub fn duplicate_deep(&self) -> Array<T>
Returns a deep copy, duplicating nested Array/Dictionary elements but keeping Object elements shared.
To create a shallow copy, use duplicate_shallow() instead.
To create a new reference to the same array data, use clone().
pub fn subarray_shallow(
&self,
range: impl SignedRange,
step: Option<i32>,
) -> Array<T>
pub fn subarray_shallow( &self, range: impl SignedRange, step: Option<i32>, ) -> Array<T>
Returns a sub-range begin..end as a new Array.
Array elements are copied to the slice, but any reference types (such as Array,
Dictionary and Object) will still refer to the same value. To create a deep copy, use
subarray_deep() instead.
Godot equivalent: slice
pub fn subarray_deep(
&self,
range: impl SignedRange,
step: Option<i32>,
) -> Array<T>
pub fn subarray_deep( &self, range: impl SignedRange, step: Option<i32>, ) -> Array<T>
Returns a sub-range begin..end as a new Array.
All nested arrays and dictionaries are duplicated and will not be shared with the original
array. Note that any Object-derived elements will still be shallow copied. To create a
shallow copy, use subarray_shallow() instead.
Godot equivalent: slice
Returns an non-exclusive iterator over the elements of the Array.
Takes the array by reference but returns its elements by value, since they are internally converted from Variant.
Notice that it’s possible to modify the Array through another reference while iterating over it. This will not result
in unsoundness or crashes, but will cause the iterator to behave in an unspecified way.
pub fn min(&self) -> Option<T>
pub fn min(&self) -> Option<T>
Returns the minimum value contained in the array if all elements are of comparable types.
If the elements can’t be compared or the array is empty, None is returned.
pub fn max(&self) -> Option<T>
pub fn max(&self) -> Option<T>
Returns the maximum value contained in the array if all elements are of comparable types.
If the elements can’t be compared or the array is empty, None is returned.
pub fn pick_random(&self) -> Option<T>
pub fn pick_random(&self) -> Option<T>
Returns a random element from the array, or None if it is empty.
pub fn find(&self, value: impl AsArg<T>, from: Option<usize>) -> Option<usize>
pub fn find(&self, value: impl AsArg<T>, from: Option<usize>) -> Option<usize>
Searches the array for the first occurrence of a value and returns its index, or None if
not found.
Starts searching at index from; pass None to search the entire array.
pub fn rfind(&self, value: impl AsArg<T>, from: Option<usize>) -> Option<usize>
pub fn rfind(&self, value: impl AsArg<T>, from: Option<usize>) -> Option<usize>
Searches the array backwards for the last occurrence of a value and returns its index, or
None if not found.
Starts searching at index from; pass None to search the entire array.
pub fn bsearch(&self, value: impl AsArg<T>) -> usize
pub fn bsearch(&self, value: impl AsArg<T>) -> usize
Finds the index of a value in a sorted array using binary search.
If the value is not present in the array, returns the insertion index that would maintain sorting order.
Calling bsearch on an unsorted array results in unspecified behavior. Consider using sort() to ensure the sorting
order is compatible with your callable’s ordering.
See also: bsearch_by(), functional_ops().bsearch_custom().
pub fn bsearch_by<F>(&self, func: F) -> Result<usize, usize>
pub fn bsearch_by<F>(&self, func: F) -> Result<usize, usize>
Finds the index of a value in a sorted array using binary search, with type-safe custom predicate.
The comparator function should return an ordering that indicates whether its argument is Less, Equal or Greater the desired value.
For example, for an ascending-ordered array, a simple predicate searching for a constant value would be |elem| elem.cmp(&4).
This follows the design of slice::binary_search_by().
If the value is found, returns Ok(index) with its index. Otherwise, returns Err(index), where index is the insertion index
that would maintain sorting order.
Calling bsearch_by on an unsorted array results in unspecified behavior. Consider using sort_unstable_by()
to ensure the sorting order is compatible with your callable’s ordering.
See also: bsearch(), functional_ops().bsearch_custom().
pub fn bsearch_custom(&self, value: impl AsArg<T>, pred: &Callable) -> usize
functional_ops().bsearch_custom()pub fn sort_unstable_by<F>(&mut self, func: F)
pub fn sort_unstable_by<F>(&mut self, func: F)
Sorts the array, using a type-safe comparator.
The predicate expects two parameters (a, b) and should return an ordering relation. For example, simple ascending ordering of the
elements themselves would be achieved with |a, b| a.cmp(b).
The sorting algorithm used is not stable.
This means that values considered equal may have their order changed when using sort_unstable_by(). For most variant types,
this distinction should not matter though.
See also: [sort_unstable()][Self::sort_unstable], [sort_unstable_custom()][Self::sort_unstable_custom].
pub fn functional_ops(&self) -> ArrayFunctionalOps<'_, T>
pub fn functional_ops(&self) -> ArrayFunctionalOps<'_, T>
Access to Godot’s functional-programming APIs based on callables.
Exposes Godot array methods such as filter(), map(), reduce() and many more. See return type docs.
pub fn into_read_only(self) -> Array<T>
pub fn into_read_only(self) -> Array<T>
Turns the array into a shallow-immutable array.
Makes the array read-only and returns the original array. The array’s elements cannot be overridden with different values, and their order cannot change. Does not apply to nested elements, such as dictionaries. This operation is irreversible.
In GDScript, arrays are automatically read-only if declared with the const keyword.
§Semantics and alternatives
You can use this in Rust, but the behavior of mutating methods is only validated in a best-effort manner (more than in GDScript though):
some methods like set() panic in Debug mode, when used on a read-only array. There is no guarantee that any attempts to change result
in feedback; some may silently do nothing.
In Rust, you can use shared references (&Array<T>) to prevent mutation. Note however that Clone can be used to create another
reference, through which mutation can still occur. For deep-immutable arrays, you’ll need to keep your Array encapsulated or directly
use Rust data structures.
Godot equivalent: make_read_only
pub fn upcast_any_array(self) -> AnyArray
pub fn upcast_any_array(self) -> AnyArray
Downgrades this typed/untyped Array<T> into an owned AnyArray.
Typically, you can use deref coercion to convert &Array<T> to &AnyArray. This method is useful if you need AnyArray by value.
It consumes self to avoid incrementing the reference count; use clone() if you use the original array further.
pub fn to_packed_array(&self) -> PackedArray<T>where
T: PackedArrayElement,
pub fn to_packed_array(&self) -> PackedArray<T>where
T: PackedArrayElement,
Converts this typed Array<T> into a PackedArray<T>.
pub fn is_read_only(&self) -> bool
pub fn is_read_only(&self) -> bool
Returns true if the array is read-only.
See into_read_only().
In GDScript, arrays are automatically read-only if declared with the const keyword.
Methods from Deref<Target = AnyArray>§
pub fn get(&self, index: usize) -> Option<Variant>
pub fn get(&self, index: usize) -> Option<Variant>
Returns the value at the specified index, or None if the index is out-of-bounds.
If you know the index is correct, use at() instead.
pub fn contains(&self, value: &Variant) -> bool
pub fn contains(&self, value: &Variant) -> bool
Returns true if the array contains the given value. Equivalent of has in GDScript.
pub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of elements in the array. Equivalent of size() in Godot.
Retrieving the size incurs an FFI call. If you know the size hasn’t changed, you may consider storing it in a variable. For loops, prefer iterators.
pub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the array is empty.
Checking for emptiness incurs an FFI call. If you know the size hasn’t changed, you may consider storing it in a variable. For loops, prefer iterators.
pub fn hash_u32(&self) -> u32
pub fn hash_u32(&self) -> u32
Returns a 32-bit integer hash value representing the array and its contents.
Arrays with equal content will always produce identical hash values. However, the reverse is not true: Different arrays can have identical hash values due to hash collisions.
pub fn front(&self) -> Option<Variant>
pub fn front(&self) -> Option<Variant>
Returns the first element in the array, or None if the array is empty.
pub fn back(&self) -> Option<Variant>
pub fn back(&self) -> Option<Variant>
Returns the last element in the array, or None if the array is empty.
pub fn clear(&mut self)
pub fn clear(&mut self)
Clears the array, removing all elements.
pub fn pop(&mut self) -> Option<Variant>
pub fn pop(&mut self) -> Option<Variant>
Removes and returns the last element of the array. Returns None if the array is empty.
Godot equivalent: pop_back
pub fn pop_front(&mut self) -> Option<Variant>
pub fn pop_front(&mut self) -> Option<Variant>
Removes and returns the first element of the array, in O(n). Returns None if the array is empty.
Note: On large arrays, this method is much slower than pop() as it will move all the
array’s elements. The larger the array, the slower pop_front() will be.
pub fn remove(&mut self, index: usize) -> Variant
pub fn remove(&mut self, index: usize) -> Variant
⚠️ Removes and returns the element at the specified index. Equivalent of pop_at in GDScript.
On large arrays, this method is much slower than pop() as it will move all the array’s
elements after the removed element. The larger the array, the slower remove() will be.
§Panics
If index is out of bounds.
pub fn shrink(&mut self, new_size: usize) -> bool
pub fn shrink(&mut self, new_size: usize) -> bool
Shrinks the array down to new_size.
This will only change the size of the array if new_size is smaller than the current size. Returns true if the array was shrunk.
If you want to increase the size of the array, use resize instead.
pub fn duplicate_shallow(&self) -> AnyArray
pub fn duplicate_shallow(&self) -> AnyArray
Returns a shallow copy, sharing reference types (Array, Dictionary, Object…) with the original array.
This operation retains the dynamic element type: copying Array<T> will yield another Array<T>.
To create a deep copy, use duplicate_deep() instead.
To create a new reference to the same array data, use clone().
pub fn duplicate_deep(&self) -> AnyArray
pub fn duplicate_deep(&self) -> AnyArray
Returns a deep copy, duplicating nested Array/Dictionary elements but keeping Object elements shared.
This operation retains the dynamic element type: copying Array<T> will yield another Array<T>.
To create a shallow copy, use duplicate_shallow() instead.
To create a new reference to the same array data, use clone().
pub fn subarray_shallow(
&self,
range: impl SignedRange,
step: Option<i32>,
) -> AnyArray
pub fn subarray_shallow( &self, range: impl SignedRange, step: Option<i32>, ) -> AnyArray
Returns a sub-range as a new array.
Array elements are copied to the slice, but any reference types (such as Array,
Dictionary and Object) will still refer to the same value. To create a deep copy, use
subarray_deep() instead.
Godot equivalent: slice
pub fn subarray_deep(
&self,
range: impl SignedRange,
step: Option<i32>,
) -> AnyArray
pub fn subarray_deep( &self, range: impl SignedRange, step: Option<i32>, ) -> AnyArray
Returns a sub-range as a new Array.
All nested arrays and dictionaries are duplicated and will not be shared with the original
array. Note that any Object-derived elements will still be shallow copied. To create a
shallow copy, use subarray_shallow() instead.
Godot equivalent: slice with deep: true
Returns an non-exclusive iterator over the elements of the Array.
Takes the array by reference but returns its elements by value, since they are internally converted from Variant.
Notice that it’s possible to modify the Array through another reference while iterating over it. This will not result
in unsoundness or crashes, but will cause the iterator to behave in an unspecified way.
pub fn min(&self) -> Option<Variant>
pub fn min(&self) -> Option<Variant>
Returns the minimum value contained in the array if all elements are of comparable types.
If the elements can’t be compared or the array is empty, None is returned.
pub fn max(&self) -> Option<Variant>
pub fn max(&self) -> Option<Variant>
Returns the maximum value contained in the array if all elements are of comparable types.
If the elements can’t be compared or the array is empty, None is returned.
pub fn pick_random(&self) -> Option<Variant>
pub fn pick_random(&self) -> Option<Variant>
Returns a random element from the array, or None if it is empty.
pub fn find(&self, value: &Variant, from: Option<usize>) -> Option<usize>
pub fn find(&self, value: &Variant, from: Option<usize>) -> Option<usize>
Searches the array for the first occurrence of a value and returns its index, or None if
not found. Starts searching at index from; pass None to search the entire array.
pub fn rfind(&self, value: &Variant, from: Option<usize>) -> Option<usize>
pub fn rfind(&self, value: &Variant, from: Option<usize>) -> Option<usize>
Searches the array backwards for the last occurrence of a value and returns its index, or
None if not found. Starts searching at index from; pass None to search the entire array.
pub fn bsearch(&self, value: &Variant) -> usize
pub fn bsearch(&self, value: &Variant) -> usize
Finds the index of an existing value in a sorted array using binary search.
Equivalent of bsearch in GDScript.
If the value is not present in the array, returns the insertion index that would maintain sorting order.
Calling bsearch on an unsorted array results in unspecified behavior.
pub fn reverse(&mut self)
pub fn reverse(&mut self)
Reverses the order of the elements in the array.
pub fn sort_unstable(&mut self)
pub fn sort_unstable(&mut self)
Sorts the array.
The sorting algorithm used is not stable.
This means that values considered equal may have their order changed when using sort_unstable(). For most variant types,
this distinction should not matter though.
See also: Array::sort_unstable_by(), sort_unstable_custom().
Godot equivalent: Array.sort()
pub fn sort_unstable_custom(&mut self, func: &Callable)
pub fn sort_unstable_custom(&mut self, func: &Callable)
Sorts the array, using type-unsafe Callable comparator.
The callable expects two parameters (lhs, rhs) and should return a bool lhs < rhs.
The sorting algorithm used is not stable.
This means that values considered equal may have their order changed when using sort_unstable_custom(). For most variant types,
this distinction should not matter though.
Type-safe alternatives: Array::sort_unstable_by(), sort_unstable().
Godot equivalent: Array.sort_custom()
pub fn shuffle(&mut self)
pub fn shuffle(&mut self)
Shuffles the array such that the items will have a random order.
This method uses the global random number generator common to methods such as randi. Call randomize to
ensure that a new seed will be used each time, if you want non-reproducible shuffling.
pub fn functional_ops(&self) -> ArrayFunctionalOps<'_, Variant>
pub fn functional_ops(&self) -> ArrayFunctionalOps<'_, Variant>
Accesses Godot’s functional-programming APIs (filter, map, reduce, etc.).
pub fn element_type(&self) -> ElementType
pub fn element_type(&self) -> ElementType
Returns the runtime element type information for this array.
The result is generally cached, so feel free to call this method repeatedly.
pub fn is_read_only(&self) -> bool
pub fn is_read_only(&self) -> bool
Returns true if the array is read-only. See [make_read_only][crate::builtin::Array::make_read_only].
Trait Implementations§
§impl<T> Clone for Array<T>where
T: ArrayElement,
Creates a new reference to the data in this array. Changes to the original array will be
reflected in the copy and vice versa.
impl<T> Clone for Array<T>where
T: ArrayElement,
Creates a new reference to the data in this array. Changes to the original array will be reflected in the copy and vice versa.
To create a (mostly) independent copy instead, see Array::duplicate_shallow() and
Array::duplicate_deep().
§impl<T> Debug for Array<T>where
T: ArrayElement,
impl<T> Debug for Array<T>where
T: ArrayElement,
§impl<T> Default for Array<T>where
T: ArrayElement,
impl<T> Default for Array<T>where
T: ArrayElement,
§impl<T> Deref for Array<T>where
T: ArrayElement,
impl<T> Deref for Array<T>where
T: ArrayElement,
§impl<T> DerefMut for Array<T>where
T: ArrayElement,
impl<T> DerefMut for Array<T>where
T: ArrayElement,
§impl<T> Display for Array<T>where
T: ArrayElement + Display,
impl<T> Display for Array<T>where
T: ArrayElement + Display,
§impl<T> Drop for Array<T>where
T: ArrayElement,
impl<T> Drop for Array<T>where
T: ArrayElement,
§impl<T, D> Export for Array<DynGd<T, D>>
#[export] for Array<DynGd<T, D>> is available only for T being Engine class (such as Node or Resource).
impl<T, D> Export for Array<DynGd<T, D>>
#[export] for Array<DynGd<T, D>> is available only for T being Engine class (such as Node or Resource).
Consider exporting Array<Gd<T>> instead of Array<DynGd<T, D>> for user-declared GDExtension classes.
§fn export_hint() -> PropertyHintInfo
fn export_hint() -> PropertyHintInfo
§impl<T> Export for Array<Gd<T>>where
T: GodotClass<Exportable = Yes> + Bounds,
impl<T> Export for Array<Gd<T>>where
T: GodotClass<Exportable = Yes> + Bounds,
§fn export_hint() -> PropertyHintInfo
fn export_hint() -> PropertyHintInfo
§impl<T> Export for Array<T>where
T: ArrayElement + Export,
impl<T> Export for Array<T>where
T: ArrayElement + Export,
§fn export_hint() -> PropertyHintInfo
fn export_hint() -> PropertyHintInfo
§impl<T> Extend<T> for Array<T>where
T: ArrayElement,
Extends a Array with the contents of an iterator.
impl<T> Extend<T> for Array<T>where
T: ArrayElement,
Extends a Array with the contents of an iterator.
§fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = T>,
fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = T>,
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)§impl<T> From<&[T]> for Array<T>where
T: ArrayElement + ToGodot,
Creates a Array from the given slice.
impl<T> From<&[T]> for Array<T>where
T: ArrayElement + ToGodot,
Creates a Array from the given slice.
§impl<T, const N: usize> From<&[T; N]> for Array<T>where
T: ArrayElement + ToGodot,
Creates a Array from the given Rust array.
impl<T, const N: usize> From<&[T; N]> for Array<T>where
T: ArrayElement + ToGodot,
Creates a Array from the given Rust array.
§impl<T> From<&Array<T>> for Vec<T>where
T: ArrayElement + FromGodot,
Converts this array to a strongly typed Rust vector.
impl<T> From<&Array<T>> for Vec<T>where
T: ArrayElement + FromGodot,
Converts this array to a strongly typed Rust vector.
§impl<T> FromGodot for Array<T>where
T: ArrayElement,
impl<T> FromGodot for Array<T>where
T: ArrayElement,
§fn try_from_godot(
via: <Array<T> as GodotConvert>::Via,
) -> Result<Array<T>, ConvertError>
fn try_from_godot( via: <Array<T> as GodotConvert>::Via, ) -> Result<Array<T>, ConvertError>
Err on failure.§fn from_godot(via: Self::Via) -> Self
fn from_godot(via: Self::Via) -> Self
§fn try_from_variant(variant: &Variant) -> Result<Self, ConvertError>
fn try_from_variant(variant: &Variant) -> Result<Self, ConvertError>
Variant, returning Err on failure.§fn from_variant(variant: &Variant) -> Self
fn from_variant(variant: &Variant) -> Self
§impl<T> FromIterator<T> for Array<T>where
T: ArrayElement + ToGodot,
Creates a Array from an iterator.
impl<T> FromIterator<T> for Array<T>where
T: ArrayElement + ToGodot,
Creates a Array from an iterator.
§fn from_iter<I>(iter: I) -> Array<T>where
I: IntoIterator<Item = T>,
fn from_iter<I>(iter: I) -> Array<T>where
I: IntoIterator<Item = T>,
§impl<T> GodotConvert for Array<T>where
T: ArrayElement,
impl<T> GodotConvert for Array<T>where
T: ArrayElement,
§impl<T> GodotImmutable for Array<T>where
T: GodotImmutable + ArrayElement,
impl<T> GodotImmutable for Array<T>where
T: GodotImmutable + ArrayElement,
fn into_runtime_immutable(self) -> Array<T>
§impl<T> IntoDynamicSend for Array<T>where
T: ArrayElement,
impl<T> IntoDynamicSend for Array<T>where
T: ArrayElement,
type Target = ThreadConfined<Array<T>>
fn into_dynamic_send(self) -> <Array<T> as IntoDynamicSend>::Target
§impl<T> PartialEq for Array<T>where
T: ArrayElement,
impl<T> PartialEq for Array<T>where
T: ArrayElement,
§impl<T> PartialOrd for Array<T>where
T: ArrayElement,
impl<T> PartialOrd for Array<T>where
T: ArrayElement,
§impl<T> ToGodot for Array<T>where
T: ArrayElement,
impl<T> ToGodot for Array<T>where
T: ArrayElement,
§fn to_godot(&self) -> &<Array<T> as GodotConvert>::Via
fn to_godot(&self) -> &<Array<T> as GodotConvert>::Via
§fn to_godot_owned(&self) -> <Array<T> as GodotConvert>::Via
fn to_godot_owned(&self) -> <Array<T> as GodotConvert>::Via
§fn to_variant(&self) -> Variant
fn to_variant(&self) -> Variant
§impl<T> Var for Array<T>where
T: ArrayElement,
impl<T> Var for Array<T>where
T: ArrayElement,
fn get_property(&self) -> <Array<T> as GodotConvert>::Via
fn set_property(&mut self, value: <Array<T> as GodotConvert>::Via)
§fn var_hint() -> PropertyHintInfo
fn var_hint() -> PropertyHintInfo
GodotType::property_info, e.g. for enums/newtypes.