gdnative_core/lib.rs
1//! # Rust bindings for the Godot game engine
2//!
3//! This crate contains high-level wrappers around the core types of Godot Engine's GDNative
4//! API, and the NativeScript feature which enables Rust code to be used as scripts.
5//!
6//! ## Memory management for core types
7//!
8//! Wrappers for most core types expose safe Rust interfaces, and it's unnecessary to mind
9//! memory management most of the times. The exceptions are `VariantArray` and `Dictionary`,
10//! internally reference-counted collections with "interior mutability" in Rust parlance. These
11//! types are modelled using the "typestate" pattern to enforce that the official
12//! [thread-safety guidelines][thread-safety]. For more information, read the type-level
13//! documentation for these types.
14//!
15//! Since it is easy to expect containers and other types to allocate a copy of their
16//! content when using the `Clone` trait, some types do not implement `Clone` and instead
17//! implement [`NewRef`](object::NewRef) which provides a `new_ref(&self) -> Self` method
18//! to create references to the same collection or object.
19//!
20//! [thread-safety]: https://docs.godotengine.org/en/stable/tutorials/threads/thread_safe_apis.html
21
22#![deny(clippy::missing_inline_in_public_items)]
23#![allow(
24 clippy::transmute_ptr_to_ptr,
25 clippy::missing_safety_doc,
26 clippy::non_send_fields_in_send_ty
27)]
28#![cfg_attr(
29 any(test, feature = "gd-test"),
30 allow(clippy::excessive_precision, clippy::disallowed_names)
31)]
32
33#[doc(hidden)]
34pub extern crate gdnative_sys as sys;
35
36#[doc(hidden)]
37pub extern crate libc;
38
39#[cfg(feature = "gd-test")]
40#[macro_use]
41extern crate approx;
42
43#[doc(inline)]
44pub use gdnative_derive::godot_wrap_method;
45
46/// Derive macros and macro attributes.
47#[doc(inline)]
48pub use gdnative_derive as derive;
49
50// Macros have to be processed before they are used.
51mod macros;
52
53pub mod core_types;
54
55pub mod export;
56pub mod globalscope;
57pub mod init;
58pub mod log;
59pub mod object;
60pub mod profiler;
61
62/// Internal low-level API for use by macros and generated bindings. Not a part of the public API.
63#[doc(hidden)]
64pub mod private;