godot_core/obj/
mod.rs

1/*
2 * Copyright (c) godot-rust; Bromeon and contributors.
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
6 */
7
8//! Types and traits related to objects.
9//!
10//! The most important symbols in this module are:
11//! * [`GodotClass`], which is implemented for every class that Godot can work with (either engine- or user-provided).
12//! * [`Gd`], a smart pointer that manages instances of Godot classes.
13
14mod base;
15mod call_deferred;
16mod casts;
17mod dyn_gd;
18mod gd;
19mod guards;
20mod instance_id;
21mod on_editor;
22mod on_ready;
23mod raw_gd;
24mod traits;
25
26pub(crate) mod rtti;
27
28pub use base::*;
29pub use call_deferred::WithDeferredCall;
30pub use dyn_gd::DynGd;
31pub use gd::*;
32pub use guards::{BaseMut, BaseRef, DynGdMut, DynGdRef, GdMut, GdRef};
33pub use instance_id::*;
34pub use on_editor::*;
35pub use on_ready::*;
36pub use raw_gd::*;
37pub use traits::*;
38
39pub mod bounds;
40pub mod script;
41pub use bounds::private::Bounds;
42
43// Do not re-export rtti here.
44
45/// Resolves the type to which a `Gd<T>` dereferences.
46///
47/// This type alias abstracts over the two `Declarer` options for Godot objects:
48/// - [`bounds::DeclEngine`]: for all engine-provided classes, `DerefTarget<T>` is `T`.
49/// - [`bounds::DeclUser`]: for Rust-defined user classes, `DerefTarget<T>` is `T::Base`.
50type GdDerefTarget<T> = <<T as Bounds>::Declarer as bounds::Declarer>::DerefTarget<T>;