Crate gdnative_core[][src]

Rust bindings for the Godot game engine

This crate contains high-level wrappers around the core types of Godot Engine's GDNative API, and the NativeScript feature which enables Rust code to be used as scripts.

Memory management for core types

Wrappers for most core types expose safe Rust interfaces, and it's unnecessary to mind memory management most of the times. The exceptions are VariantArray and Dictionary, internally reference-counted collections with "interior mutability" in Rust parlance. These types are modelled using the "typestate" pattern to enforce that the official thread-safety guidelines. For more information, read the type-level documentation for these types.

Since it is easy to expect containers and other types to allocate a copy of their content when using the Clone trait, some types do not implement Clone and instead implement NewRef which provides a new_ref(&self) -> Self method to create references to the same collection or object.

Re-exports

pub use object::GodotObject;
pub use object::Null;
pub use object::Ref;
pub use object::TRef;

Modules

core_types

Types that represent core-datatypes of Godot.

nativescript

Types and functions related to the NativeScript extension of GDNative.

object
ref_kind

Marker types to express the memory management method of Godot types.

thread_access

Typestates to express thread safety of Godot types.

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_init

Declare all the API endpoints necessary to initialize a NativeScript library.

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_method

Convenience macro to wrap an object's method into a function pointer that can be passed to the engine when registering a class.

profile_sig

Convenience macro to create a profiling signature with a given tag.

Structs

InitializeInfo
TerminateInfo

Traits

NewRef

A trait for incrementing the reference count to a Godot object.

Type Definitions

GodotResult