Enum ElementType
pub enum ElementType {
Untyped,
Builtin(VariantType),
Class(ClassId),
ScriptClass(ElementScript),
}Expand description
Dynamic type information of Godot arrays and dictionaries.
Used in the following APIs:
While Rust’s type parameters provide compile-time type information, this method supplies additional RTTI (runtime type information).
For example, Array<Gd<RefCounted>> may store classes or scripts derived from RefCounted.
Variants§
Untyped
Untyped array/dictionary that can contain any Variant.
Builtin(VariantType)
Typed array with built-in type (e.g., Array<i64>, Array<GString>).
Class(ClassId)
Typed array with class (e.g., Array<Gd<Node3D>>, Array<Gd<Resource>>).
ScriptClass(ElementScript)
Typed array with a script-based class (e.g. GDScript class Enemy).
Arrays of this element type cannot be created directly in Rust code. They come into play when you have a GDScript with
class_name MyClass, and then create a typed Array[MyClass] in GDScript. In Rust, these arrays can be represented with
their native base class (the one mentioned in extends in GDScript), e.g. Array<Gd<RefCounted>>.
Implementations§
§impl ElementType
impl ElementType
pub fn of<T>() -> ElementTypewhere
T: ArrayElement,
pub fn of<T>() -> ElementTypewhere
T: ArrayElement,
Build element type info for a compile-time element T.
pub fn is_typed(&self) -> bool
pub fn is_typed(&self) -> bool
True if this denotes a typed array/dictionary element.
Variant is considered untyped, every other type is typed.
pub fn variant_type(&self) -> VariantType
pub fn variant_type(&self) -> VariantType
The VariantType corresponding to this element type.
pub fn class_id(&self) -> Option<ClassId>
pub fn class_id(&self) -> Option<ClassId>
The class ID, if this type is of type Class or ScriptClass.
Trait Implementations§
§impl Clone for ElementType
impl Clone for ElementType
§fn clone(&self) -> ElementType
fn clone(&self) -> ElementType
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for ElementType
impl Debug for ElementType
§impl PartialEq for ElementType
impl PartialEq for ElementType
impl Copy for ElementType
impl Eq for ElementType
impl StructuralPartialEq for ElementType
Auto Trait Implementations§
impl Freeze for ElementType
impl RefUnwindSafe for ElementType
impl Send for ElementType
impl Sync for ElementType
impl Unpin for ElementType
impl UnwindSafe for ElementType
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)