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

Axis-aligned bounding box.
A pool array access that is (assumed to be) aligned.
A 3x3 matrix, typically used as an orthogonal basis for Transform.
RGBA color with 32-bit floating point components.
A reference-counted Dictionary of Variant key-value pairs.
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’s reference-counted string type.
Error indicating that an operator result is invalid.
Error indicating that an i64 cannot be converted to a Margin.
Wrapper type around a FromVariant result that may not be a success
A pool array access that may be unaligned.
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.
A pool array write access with an owned aligned copy. The data is written back when this is dropped.
3D plane in Hessian form: a*b + b*y + c*z + d = 0
A reference-counted CoW typed vector using Godot’s pool allocator, generic over possible element types.
Quaternion, used to represent 3D rotations.
RAII read guard.
2D axis-aligned bounding box.
A RID (“resource ID”) is an opaque handle that refers to a Godot Resource.
Interned string.
Affine 3D transform (3x4 matrix).
Affine 2D transform (2x3 matrix).
A Variant can represent all Godot values (core types or Object class instances).
A reference-counted Variant vector. Godot’s generic array data type. Negative indices can be used to count from the right.
2D vector class.
3D vector class.
RAII write guard.

Enums

Error type returned by FromVariant::from_variant.
Error indicating that a GodotChar cannot be converted to a char.
Error codes used in various Godot APIs.
Provides compatibility with Godot’s Margin enum through the TryFrom trait.
Rust enum associating each primitive variant type to its value.
Godot variant operator kind.

Traits

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.
Types that can be converted from a Variant. Conversions are performed in Rust, and can be implemented for custom types.
Trait for array access guards
Types that can only be safely converted to a Variant as owned values. Such types cannot implement ToVariant in general, but can still be passed to API methods as arguments, or used as return values. Notably, this includes Unique arrays, dictionaries, and references to Godot objects and instances.
Trait for element types that can be contained in PoolArray. This trait is sealed and has no public interface.
Types that can be converted to a Variant.
Trait for types whose ToVariant implementations preserve equivalence.
Marker trait for write access guards

Type Definitions

A reference-counted vector of u8 that uses Godot’s pool allocator.
A reference-counted vector of Color that uses Godot’s pool allocator.
A reference-counted vector of f32 that uses Godot’s pool allocator.
Result type with GodotError
A reference-counted vector of i32 that uses Godot’s pool allocator.
A RAII read access for Godot pool arrays.
A reference-counted vector of GodotString that uses Godot’s pool allocator.
A reference-counted vector of Vector2 that uses Godot’s pool allocator.
A reference-counted vector of Vector3 that uses Godot’s pool allocator.
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().