Skip to content

Commit

Permalink
Macros now exported under gdnative::macros, not in crate root
Browse files Browse the repository at this point in the history
  • Loading branch information
Bromeon committed Oct 11, 2021
1 parent 9abb46e commit 8b93d92
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 36 deletions.
2 changes: 1 addition & 1 deletion gdnative-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ mod variant;
/// impl gdnative::nativescript::NativeClassMethods for Foo {
/// fn register(builder: &ClassBuilder<Self>) {
/// use gdnative::nativescript::export::*;
/// builder.build_method("foo", gdnative::godot_wrap_method!(Foo, fn foo(&self, _owner: &Reference, bar: i64) -> i64))
/// builder.build_method("foo", gdnative::macros::godot_wrap_method!(Foo, fn foo(&self, _owner: &Reference, bar: i64) -> i64))
/// .with_rpc_mode(RpcMode::Disabled)
/// .done_stateless();
/// }
Expand Down
2 changes: 1 addition & 1 deletion gdnative-derive/src/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ pub(crate) fn derive_methods(item_impl: ItemImpl) -> TokenStream2 {

quote_spanned!( sig_span=>
{
let method = ::gdnative::godot_wrap_method!(
let method = ::gdnative::macros::godot_wrap_method!(
#class_name,
fn #name ( #( #args )* ) -> #ret_ty
);
Expand Down
18 changes: 10 additions & 8 deletions gdnative/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,18 @@
#[doc(inline)]
pub use gdnative_core::{core_types, nativescript, object};

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

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

/// Derive macros and macro attributes.
#[doc(inline)]
Expand Down
8 changes: 4 additions & 4 deletions test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ fn test_underscore_method_binding() -> bool {
.is_ok();

if !ok {
gdnative::godot_error!(" !! Test test_underscore_method_binding failed");
godot_error!(" !! Test test_underscore_method_binding failed");
}

ok
Expand Down Expand Up @@ -165,7 +165,7 @@ fn test_rust_class_construction() -> bool {
.is_ok();

if !ok {
gdnative::godot_error!(" !! Test test_rust_class_construction failed");
godot_error!(" !! Test test_rust_class_construction failed");
}

ok
Expand Down Expand Up @@ -247,7 +247,7 @@ fn test_from_instance_id() -> bool {
.is_ok();

if !ok {
gdnative::godot_error!(" !! Test test_from_instance_id failed");
godot_error!(" !! Test test_from_instance_id failed");
}

ok
Expand All @@ -268,4 +268,4 @@ fn init(handle: InitHandle) {
test_vararray_return::register(handle);
}

gdnative::godot_init!(init);
godot_init!(init);
2 changes: 1 addition & 1 deletion test/src/test_constructor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ fn test_from_class_name() -> bool {
.is_ok();

if !ok {
gdnative::godot_error!(" !! Test test_from_class_name failed");
godot_error!(" !! Test test_from_class_name failed");
}

ok
Expand Down
8 changes: 4 additions & 4 deletions test/src/test_derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ fn test_derive_to_variant() -> bool {
.is_ok();

if !ok {
gdnative::godot_error!(" !! Test test_derive_to_variant failed");
godot_error!(" !! Test test_derive_to_variant failed");
}

ok
Expand Down Expand Up @@ -167,7 +167,7 @@ fn test_derive_owned_to_variant() -> bool {
.is_ok();

if !ok {
gdnative::godot_error!(" !! Test test_derive_owned_to_variant failed");
godot_error!(" !! Test test_derive_owned_to_variant failed");
}

ok
Expand Down Expand Up @@ -278,7 +278,7 @@ fn test_derive_nativeclass_with_property_hooks() -> bool {
.is_ok();

if !ok {
gdnative::godot_error!(" !! Test test_derive_owned_to_variant failed");
godot_error!(" !! Test test_derive_owned_to_variant failed");
}

ok
Expand Down Expand Up @@ -315,7 +315,7 @@ fn test_derive_nativeclass_without_constructor() -> bool {
.is_ok();

if !ok {
gdnative::godot_error!(" !! Test test_derive_nativeclass_without_constructor failed");
godot_error!(" !! Test test_derive_nativeclass_without_constructor failed");
}

ok
Expand Down
2 changes: 1 addition & 1 deletion test/src/test_free_ub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ fn test_owner_free_ub() -> bool {
.is_ok();

if !ok {
gdnative::godot_error!(" !! Test test_owner_free_ub failed");
godot_error!(" !! Test test_owner_free_ub failed");
}

ok
Expand Down
2 changes: 1 addition & 1 deletion test/src/test_map_owned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ fn test_map_owned() -> bool {
.is_ok();

if !ok {
gdnative::godot_error!(" !! Test test_map_owned failed");
godot_error!(" !! Test test_map_owned failed");
}

ok
Expand Down
4 changes: 2 additions & 2 deletions test/src/test_register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ fn test_register_property() -> bool {
.is_ok();

if !ok {
gdnative::godot_error!(" !! Test test_register_property failed");
godot_error!(" !! Test test_register_property failed");
}

ok
Expand Down Expand Up @@ -236,7 +236,7 @@ fn test_advanced_methods() -> bool {
.is_ok();

if !ok {
gdnative::godot_error!(" !! Test test_advanced_methods failed");
godot_error!(" !! Test test_advanced_methods failed");
}

ok
Expand Down
2 changes: 1 addition & 1 deletion test/src/test_return_leak.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ fn test_return_leak() -> bool {
.is_ok();

if !ok {
gdnative::godot_error!(" !! Test test_return_leak failed");
godot_error!(" !! Test test_return_leak failed");
}

ok
Expand Down
18 changes: 9 additions & 9 deletions test/src/test_serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub(crate) fn run_tests() -> bool {
status &= test_variant_eq();
status &= test_dispatch_eq();
if !status {
gdnative::godot_error!(" !!!! Can't run serde tests, Foo::[to/from]_variant is broken!");
godot_error!(" !!!! Can't run serde tests, Foo::[to/from]_variant is broken!");
return false;
}

Expand Down Expand Up @@ -126,7 +126,7 @@ fn test_variant_eq() -> bool {
.is_ok();

if !ok {
gdnative::godot_error!(" !! Test test_variant_eq failed");
godot_error!(" !! Test test_variant_eq failed");
}

ok
Expand All @@ -145,7 +145,7 @@ fn test_dispatch_eq() -> bool {
.is_ok();

if !ok {
gdnative::godot_error!(" !! Test test_dispatch_eq failed");
godot_error!(" !! Test test_dispatch_eq failed");
}

ok
Expand Down Expand Up @@ -174,7 +174,7 @@ fn test_ron() -> bool {
.is_ok();

if !ok {
gdnative::godot_error!(" !! Test test_ron failed");
godot_error!(" !! Test test_ron failed");
}

ok
Expand All @@ -201,7 +201,7 @@ fn test_json() -> bool {
.is_ok();

if !ok {
gdnative::godot_error!(" !! Test test_json failed");
godot_error!(" !! Test test_json failed");
}

ok
Expand All @@ -226,7 +226,7 @@ fn test_yaml() -> bool {
.is_ok();

if !ok {
gdnative::godot_error!(" !! Test test_yaml failed");
godot_error!(" !! Test test_yaml failed");
}

ok
Expand All @@ -252,7 +252,7 @@ fn test_cbor() -> bool {
.is_ok();

if !ok {
gdnative::godot_error!(" !! Test test_cbor failed");
godot_error!(" !! Test test_cbor failed");
}

ok
Expand Down Expand Up @@ -280,7 +280,7 @@ fn test_msgpack() -> bool {
.is_ok();

if !ok {
gdnative::godot_error!(" !! Test test_msgpack failed");
godot_error!(" !! Test test_msgpack failed");
}

ok
Expand All @@ -307,7 +307,7 @@ fn test_bincode() -> bool {
.is_ok();

if !ok {
gdnative::godot_error!(" !! Test test_bincode failed");
godot_error!(" !! Test test_bincode failed");
}

ok
Expand Down
2 changes: 1 addition & 1 deletion test/src/test_vararray_return.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fn test_vararray_return_crash() -> bool {
.is_ok();

if !ok {
gdnative::godot_error!(" !! Test test_vararray_return_crash failed");
godot_error!(" !! Test test_vararray_return_crash failed");
}

ok
Expand Down
2 changes: 1 addition & 1 deletion test/src/test_variant_call_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ fn test_variant_call_args() -> bool {
.is_ok();

if !ok {
gdnative::godot_error!(" !! Test test_variant_call_args failed");
godot_error!(" !! Test test_variant_call_args failed");
}

ok
Expand Down
2 changes: 1 addition & 1 deletion test/src/test_variant_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fn test_variant_ops() -> bool {
.is_ok();

if !ok {
gdnative::godot_error!(" !! Test test_variant_ops failed");
godot_error!(" !! Test test_variant_ops failed");
}

ok
Expand Down

0 comments on commit 8b93d92

Please sign in to comment.