Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

godot-rust: Orientation

FFI bindingsRust inside a C++ engineRevision 637cef7

godot-rust exposes Godot 4’s GDExtension API as an idiomatic Rust library. Unlike Bevy, Rust does not own the engine loop or object model. Godot creates, calls, reference-counts, and destroys objects; the binding must preserve Rust’s rules across that foreign lifecycle.

Godot loads extension → register generated class metadata
→ Godot invokes C callback → recover Rust instance
→ dynamic bind guard → typed method → convert return to Godot

Design thesis

godot-rust concentrates unsafe engine interoperation behind generated glue, typed object handles, runtime borrow guards, and explicit thread/lifecycle checks so application code can look like ordinary Rust.

Study godot-ffi, godot-codegen, godot-macros, godot-cell, and godot-core as successive layers rather than one undifferentiated binding.