Expand description
Types that represent core types of Godot.
In contrast to generated Godot class types from the api module, the types in here are hand-written in idiomatic Rust and
are the counterparts to built-in types in GDScript.
godot-rust provides optional serialization support for many core types. Enable the feature serde to make use of it.
Structs§
- Aabb
- Axis-aligned bounding box.
- Aligned
- A pool array access that is (assumed to be) aligned.
- Basis
- A 3x3 matrix, typically used as an orthogonal basis for
Transform. - Color
- RGBA color with 32-bit floating point components.
- Dictionary
- A reference-counted
DictionaryofVariantkey-value pairs. - Godot
Char - Type representing a character in Godot’s native encoding. Can be converted to and
from
char. Depending on the platform, this might not always be able to represent a full code point. - Godot
String - Godot’s reference-counted string type.
- Invalid
Op - Error indicating that an operator result is invalid.
- Margin
Error - Error indicating that an
i64cannot be converted to aMargin. - Maybe
Not - Wrapper type around a
FromVariantresult that may not be a success - Maybe
Unaligned - A pool array access that may be unaligned.
- Node
Path - A reference-counted relative or absolute path in a scene tree, for use with
Node.get_node()and similar functions. It can reference a node, a resource within a node, or a property of a node or resource. - Owned
- A pool array write access with an owned aligned copy. The data is written back when this is dropped.
- Plane
- 3D plane in Hessian form:
a*b + b*y + c*z + d = 0 - Pool
Array - A reference-counted CoW typed vector using Godot’s pool allocator, generic over possible element types.
- Quat
- Quaternion, used to represent 3D rotations.
- Read
Guard - RAII read guard.
- Rect2
- 2D axis-aligned bounding box.
- Rid
- A RID (“resource ID”) is an opaque handle that refers to a Godot
Resource. - String
Name - Interned string.
- Transform
- Affine 3D transform (3x4 matrix).
- Transform2D
- Affine 2D transform (2x3 matrix).
- Variant
- A
Variantcan represent all Godot values (core types orObjectclass instances). - Variant
Array - A reference-counted
Variantvector. Godot’s generic array data type. Negative indices can be used to count from the right. - Vector2
- 2D vector class.
- Vector3
- 3D vector class.
- Write
Guard - RAII write guard.
Enums§
- Axis
- Call
Error - From
Variant Error - Error type returned by
FromVariant::from_variant. - Godot
Char Error - Error indicating that a
GodotCharcannot be converted to achar. - Godot
Error - Error codes used in various Godot APIs.
- Margin
- Provides compatibility with Godot’s
Marginenum through theTryFromtrait. - Variant
Dispatch - Rust enum associating each primitive variant type to its value.
- Variant
Enum Repr - Variant
Operator - Godot variant operator kind.
- Variant
Struct Repr - Variant
Type
Traits§
- Coerce
From Variant - Types that can be coerced from a
Variant. Coercions are provided by Godot, with results consistent with GDScript. This cannot be implemented for custom types. - From
Variant - Types that can be converted from a
Variant. Conversions are performed in Rust, and can be implemented for custom types. - Guard
- Trait for array access guards
- Owned
ToVariant - Types that can only be safely converted to a
Variantas owned values. Such types cannot implementToVariantin general, but can still be passed to API methods as arguments, or used as return values. Notably, this includesUniquearrays, dictionaries, and references to Godot objects and instances. - Pool
Element - Trait for element types that can be contained in
PoolArray. This trait is sealed and has no public interface. - ToVariant
- Types that can be converted to a
Variant. - ToVariant
Eq - Trait for types whose
ToVariantimplementations preserve equivalence. - Write
Ptr - Marker trait for write access guards
Type Aliases§
- Byte
Array Deprecated - A reference-counted vector of
u8that uses Godot’s pool allocator. - Color
Array Deprecated - A reference-counted vector of
Colorthat uses Godot’s pool allocator. - Float32
Array Deprecated - A reference-counted vector of
f32that uses Godot’s pool allocator. - Godot
Result - Result type with GodotError
- Int32
Array Deprecated - A reference-counted vector of
i32that uses Godot’s pool allocator. - Read
- A RAII read access for Godot pool arrays.
- String
Array Deprecated - A reference-counted vector of
GodotStringthat uses Godot’s pool allocator. - Vector2
Array Deprecated - A reference-counted vector of
Vector2that uses Godot’s pool allocator. - Vector3
Array Deprecated - A reference-counted vector of
Vector3that uses Godot’s pool allocator. - Write
- A RAII write access for Godot pool arrays. This will only lock the CoW container once,
as opposed to every time with methods like
push().