Skip to content

Commit 46a271f

Browse files
committed
Ensure prelude contains each symbol only once
Most symbols appear directly in prelude without modules. There is 'user_data' nested, as it's used rarely and helps organize its types.
1 parent cc96860 commit 46a271f

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

gdnative-derive/src/native_script.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ pub(crate) fn impl_empty_nativeclass(derive_input: &DeriveInput) -> TokenStream2
2222

2323
quote! {
2424
#derived
25-
impl ::gdnative::prelude::NativeClass for #name {
25+
impl ::gdnative::nativescript::NativeClass for #name {
2626
type Base = ::gdnative::api::Object;
27-
type UserData = ::gdnative::prelude::LocalCellData<Self>;
27+
type UserData = ::gdnative::nativescript::user_data::LocalCellData<Self>;
2828

2929
fn class_name() -> &'static str {
3030
unimplemented!()

gdnative/src/prelude.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
pub use gdnative_core::core_types::{
2-
self, Aabb, Basis, ByteArray, Color, ColorArray, Dictionary, Float32Array, GodotError,
3-
GodotString, Int32Array, NodePath, Plane, Quat, Rect2, Rid, StringArray, StringName, Transform,
4-
Transform2D, TypedArray, Variant, VariantArray, VariantDispatch, VariantOperator, VariantType,
5-
Vector2, Vector2Array, Vector3, Vector3Array,
2+
Aabb, Basis, ByteArray, Color, ColorArray, Dictionary, Float32Array, GodotError, GodotString,
3+
Int32Array, NodePath, Plane, Quat, Rect2, Rid, StringArray, StringName, Transform, Transform2D,
4+
TypedArray, Variant, VariantArray, VariantDispatch, VariantOperator, VariantType, Vector2,
5+
Vector2Array, Vector3, Vector3Array,
66
};
77

88
pub use gdnative_core::core_types::{
@@ -16,15 +16,20 @@ pub use gdnative_core::object::{
1616
};
1717

1818
pub use gdnative_core::nativescript::{
19-
self,
2019
export::{
2120
ClassBuilder, ExportInfo, InitHandle, Method, MethodBuilder, PropertyUsage, Signal,
2221
SignalArgument,
2322
},
24-
user_data::{self, Aether, ArcData, LocalCellData, MutexData, RwLockData},
2523
Instance, NativeClass, NativeClassMethods, RefInstance,
2624
};
2725

26+
// Re-export selected user_data types, but keep qualified due to rather generic names
27+
pub mod user_data {
28+
pub use gdnative_core::nativescript::user_data::{
29+
Aether, ArcData, LocalCellData, MutexData, RwLockData,
30+
};
31+
}
32+
2833
pub use gdnative_core::{
2934
godot_dbg, godot_error, godot_gdnative_init, godot_gdnative_terminate, godot_init,
3035
godot_nativescript_init, godot_print, godot_site, godot_warn,

0 commit comments

Comments
 (0)