[−][src]Crate gdnative_core
Rust bindings for the Godot game engine
This crate contains high-level wrappers around the Godot game engine's gdnaive API. Some of the types were automatically generated from the engine's JSON API description, and some other types are hand made wrappers around the core C types.
Memory management
Reference counting
A lot of the types provided by the engine are internally reference counted and
allow mutable aliasing.
In rust parlance this means that a type such as gdnative::ConcavePolygonShape2D
is functionally equivalent to a Rc<Cell<Something>>
rather than Rc<Something>
.
Since it is easy to expect containers and other types to allocate a copy of their
content when using the Clone
trait, most of these types do not implement Clone
and instead provide a new_ref(&self) -> Self
method to create references to the
same collection or object.
Manually managed objects
Some types are manually managed. This means that ownership can be passed to the
engine or the object must be carefully deallocated using the object's free
method.
Re-exports
pub use crate::geom::*; |
pub use crate::user_data::Map; |
pub use crate::user_data::MapMut; |
pub use crate::user_data::UserData; |
Modules
access | Maybe unaligned pool array access |
geom | Geometric types. |
init | Types and functionalities to declare and initialize gdnative classes. |
user_data | Customizable user-data wrappers. |
Macros
godot_dbg | Prints and returns the value of a given expression for quick and dirty debugging, using the engine's logging system (visible in the editor). |
godot_error | Print an error using the engine's logging system (visible in the editor). |
godot_gdnative_init | Declare the API endpoint to initialize the gdnative API on startup. |
godot_gdnative_terminate | Declare the API endpoint invoked during shutdown. |
godot_nativescript_init | Declare the API endpoint to initialize nativescript classes on startup. |
godot_print | Print a message using the engine's logging system (visible in the editor). |
godot_warn | Print a warning using the engine's logging system (visible in the editor). |
godot_wrap_constructor | Convenience macro to wrap an object's constructor into a function pointer that can be passed to the engine when registering a class. |
godot_wrap_destructor | Convenience macro to wrap an object's destructor into a function pointer that can be passed to the engine when registering a class. |
godot_wrap_method | Convenience macro to wrap an object's method into a function pointer that can be passed to the engine when registering a class. |
Structs
ByteArray | A reference-counted vector of bytes that uses Godot's pool allocator. |
Color | RGBA color with 32 bits floating point components. |
ColorArray | A reference-counted vector of |
Dictionary | A reference-counted |
Float32Array | A reference-counted vector of |
FreeOnDrop | A wrapper that automatically frees the object when dropped. |
GodotApi | |
GodotString | Godot's reference-counted string type. |
Instance | A reference to a GodotObject with a rust NativeClass attached. |
Int32Array | A reference-counted vector of |
Iter | |
IterMut | |
MaybeNot | Wrapper type around a |
NodePath | A reference-counted relative or absolute path in a scene tree, for use with |
Object | The base class of most Godot classes. |
QueueFreeOnDrop | A wrapper that automatically enqueues the object for deletion when dropped. |
Reference | Base class of all reference-counted types. Inherits |
Rid | The RID type is used to access the unique integer ID of a resource. They are opaque, so they do not grant access to the associated resource by themselves. |
StringArray | A vector of |
StringName | |
Variant | A |
VariantArray | A reference-counted |
Vector2Array | A reference-counted vector of |
Vector3Array | A reference-counted vector of |
Enums
CallError | |
FromVariantError | Error type returned by |
GodotError | |
ObjectConnectFlags | |
VariantEnumRepr | |
VariantOperator | |
VariantStructRepr | |
VariantType | |
Vector3Axis |
Traits
Free | Manually managed Godot classes implementing |
FromVariant | Types that can be converted from a |
GodotObject | Internal details. |
Instanciable | GodotObjects that have a zero argument constructor. |
NativeClass | Trait used for describing and initializing a Godot script class. |
NativeClassMethods | Trait used to provide information of Godot-exposed methods of a script class. |
Point2Godot | Helper methods for |
QueueFree | Manually managed Godot classes implementing |
ToVariant | Types that can be converted to a |
Vector2Godot | Helper methods for |
Functions
result_from_sys |
Type Definitions
GodotResult |