Skip to content

Commit 8b93d92

Browse files
committed
Macros now exported under gdnative::macros, not in crate root
1 parent 9abb46e commit 8b93d92

14 files changed

+38
-36
lines changed

gdnative-derive/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ mod variant;
5050
/// impl gdnative::nativescript::NativeClassMethods for Foo {
5151
/// fn register(builder: &ClassBuilder<Self>) {
5252
/// use gdnative::nativescript::export::*;
53-
/// builder.build_method("foo", gdnative::godot_wrap_method!(Foo, fn foo(&self, _owner: &Reference, bar: i64) -> i64))
53+
/// builder.build_method("foo", gdnative::macros::godot_wrap_method!(Foo, fn foo(&self, _owner: &Reference, bar: i64) -> i64))
5454
/// .with_rpc_mode(RpcMode::Disabled)
5555
/// .done_stateless();
5656
/// }

gdnative-derive/src/methods.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ pub(crate) fn derive_methods(item_impl: ItemImpl) -> TokenStream2 {
128128

129129
quote_spanned!( sig_span=>
130130
{
131-
let method = ::gdnative::godot_wrap_method!(
131+
let method = ::gdnative::macros::godot_wrap_method!(
132132
#class_name,
133133
fn #name ( #( #args )* ) -> #ret_ty
134134
);

gdnative/src/lib.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,18 @@
6060
#[doc(inline)]
6161
pub use gdnative_core::{core_types, nativescript, object};
6262

63-
// Make macros available inside crate on top-level, for convenience and to make other macros look nicer
64-
// For the user, they are exported either in prelude (convenience) or fully qualified.
65-
#[deprecated]
66-
pub use gdnative_core::{
67-
godot_dbg, godot_error, godot_gdnative_init, godot_gdnative_terminate, godot_init,
68-
godot_nativescript_init, godot_print, godot_warn, godot_wrap_method,
69-
};
63+
/// Collection of declarative `godot_*` macros, mostly for GDNative registration and output.
64+
pub mod macros {
65+
pub use gdnative_core::{
66+
godot_dbg, godot_error, godot_gdnative_init, godot_gdnative_terminate, godot_init,
67+
godot_nativescript_init, godot_print, godot_warn, godot_wrap_method,
68+
};
69+
}
7070

71+
// Implementation details (e.g. used by macros).
72+
// However, do not re-export macros (on crate level), thus no wildcard
7173
#[doc(hidden)]
72-
pub use gdnative_core::*;
74+
pub use gdnative_core::{libc, sys};
7375

7476
/// Derive macros and macro attributes.
7577
#[doc(inline)]

test/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ fn test_underscore_method_binding() -> bool {
8686
.is_ok();
8787

8888
if !ok {
89-
gdnative::godot_error!(" !! Test test_underscore_method_binding failed");
89+
godot_error!(" !! Test test_underscore_method_binding failed");
9090
}
9191

9292
ok
@@ -165,7 +165,7 @@ fn test_rust_class_construction() -> bool {
165165
.is_ok();
166166

167167
if !ok {
168-
gdnative::godot_error!(" !! Test test_rust_class_construction failed");
168+
godot_error!(" !! Test test_rust_class_construction failed");
169169
}
170170

171171
ok
@@ -247,7 +247,7 @@ fn test_from_instance_id() -> bool {
247247
.is_ok();
248248

249249
if !ok {
250-
gdnative::godot_error!(" !! Test test_from_instance_id failed");
250+
godot_error!(" !! Test test_from_instance_id failed");
251251
}
252252

253253
ok
@@ -268,4 +268,4 @@ fn init(handle: InitHandle) {
268268
test_vararray_return::register(handle);
269269
}
270270

271-
gdnative::godot_init!(init);
271+
godot_init!(init);

test/src/test_constructor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ fn test_from_class_name() -> bool {
6262
.is_ok();
6363

6464
if !ok {
65-
gdnative::godot_error!(" !! Test test_from_class_name failed");
65+
godot_error!(" !! Test test_from_class_name failed");
6666
}
6767

6868
ok

test/src/test_derive.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ fn test_derive_to_variant() -> bool {
129129
.is_ok();
130130

131131
if !ok {
132-
gdnative::godot_error!(" !! Test test_derive_to_variant failed");
132+
godot_error!(" !! Test test_derive_to_variant failed");
133133
}
134134

135135
ok
@@ -167,7 +167,7 @@ fn test_derive_owned_to_variant() -> bool {
167167
.is_ok();
168168

169169
if !ok {
170-
gdnative::godot_error!(" !! Test test_derive_owned_to_variant failed");
170+
godot_error!(" !! Test test_derive_owned_to_variant failed");
171171
}
172172

173173
ok
@@ -278,7 +278,7 @@ fn test_derive_nativeclass_with_property_hooks() -> bool {
278278
.is_ok();
279279

280280
if !ok {
281-
gdnative::godot_error!(" !! Test test_derive_owned_to_variant failed");
281+
godot_error!(" !! Test test_derive_owned_to_variant failed");
282282
}
283283

284284
ok
@@ -315,7 +315,7 @@ fn test_derive_nativeclass_without_constructor() -> bool {
315315
.is_ok();
316316

317317
if !ok {
318-
gdnative::godot_error!(" !! Test test_derive_nativeclass_without_constructor failed");
318+
godot_error!(" !! Test test_derive_nativeclass_without_constructor failed");
319319
}
320320

321321
ok

test/src/test_free_ub.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ fn test_owner_free_ub() -> bool {
7575
.is_ok();
7676

7777
if !ok {
78-
gdnative::godot_error!(" !! Test test_owner_free_ub failed");
78+
godot_error!(" !! Test test_owner_free_ub failed");
7979
}
8080

8181
ok

test/src/test_map_owned.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ fn test_map_owned() -> bool {
6262
.is_ok();
6363

6464
if !ok {
65-
gdnative::godot_error!(" !! Test test_map_owned failed");
65+
godot_error!(" !! Test test_map_owned failed");
6666
}
6767

6868
ok

test/src/test_register.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ fn test_register_property() -> bool {
109109
.is_ok();
110110

111111
if !ok {
112-
gdnative::godot_error!(" !! Test test_register_property failed");
112+
godot_error!(" !! Test test_register_property failed");
113113
}
114114

115115
ok
@@ -236,7 +236,7 @@ fn test_advanced_methods() -> bool {
236236
.is_ok();
237237

238238
if !ok {
239-
gdnative::godot_error!(" !! Test test_advanced_methods failed");
239+
godot_error!(" !! Test test_advanced_methods failed");
240240
}
241241

242242
ok

test/src/test_return_leak.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ fn test_return_leak() -> bool {
8383
.is_ok();
8484

8585
if !ok {
86-
gdnative::godot_error!(" !! Test test_return_leak failed");
86+
godot_error!(" !! Test test_return_leak failed");
8787
}
8888

8989
ok

0 commit comments

Comments
 (0)